yosiat / panko_serializer

High Performance JSON Serialization for ActiveRecord & Ruby Objects
https://panko.dev
MIT License
592 stars 36 forks source link

Respect namespacing in SerializerResolver #93

Closed casperisfine closed 3 years ago

casperisfine commented 3 years ago

Context

I'm trying to convert one of our app that uses AMS 0.9 (Shopify/shipit-engine#1139), and one small issue I ran into is that Shipit is a Rails engine, as such all constants are namespaced under Shipit::.

So none of the automatic serializer resolution worked because it would look for e.g. ::UserSerializer instead of Shipit::UserSerializer.

This PR

We simply first look for a serializer inside the namespace we're defining the relation, if not found we fallback to the top level namespace.

PS: thanks for the two very quick merges!

casperisfine commented 3 years ago

Hum, hold on, there's some issue with the feature testing.

casperisfine commented 3 years ago

Let me know if you want me to release a version

That would be awesome, as I have https://github.com/Shopify/shipit-engine/pull/1139 green, but I can't ship it using a git gem.

yosiat commented 3 years ago

I'll wait for the CI to pass on latest master (pushed version bump for Oj), once it's passing I'll release 0.7.5.

yosiat commented 3 years ago

@casperisfine Thanks for all of your contributions! released 0.7.5

https://github.com/panko-serializer/panko_serializer/releases/tag/v0.7.5

casperisfine commented 3 years ago

Welcome, thanks for the merges and the release!