You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi team!
I suppose almost everyone use new and serialized_json at the same time, so I suggest that FastJsonapi::ObjectSerializer should have render, which is syntax sugar of .new(args).serialized_json.
A situation when tihs feature would be useful is, for example, when you want to serialize a poro with other serializer(e.g. serialize pagy with blueprinter to generate a json of pagination links). If FastJsonapi has render, we can use any serializer with polymorphism because serializers recommended in the README.md of active_model_serializers, such as blueprinter and jsonapi-rb , have render to serialize objects.
The text was updated successfully, but these errors were encountered:
To some extend, this is related to the #175 and #102 and I would argue how generic a render method can be in the context of a generic serialization library.
Just some of reasons why this might be very much framework implementation specific:
content type handling
pagination (as already mentioned)
resource vs. error serialization
single vs. collection serialization
serializer params/args DRY handling
As I mentioned before, it's up to the fast_jsonapi team to decide how generic the library should be. In the meantime consider taking a look at stas/jsonapi.rb gem which does this for you.
Hi team!
I suppose almost everyone use
new
andserialized_json
at the same time, so I suggest that FastJsonapi::ObjectSerializer should haverender
, which is syntax sugar of.new(args).serialized_json
.A situation when tihs feature would be useful is, for example, when you want to serialize a poro with other serializer(e.g. serialize pagy with blueprinter to generate a json of pagination links). If FastJsonapi has
render
, we can use any serializer with polymorphism because serializers recommended in the README.md of active_model_serializers, such as blueprinter and jsonapi-rb , haverender
to serialize objects.The text was updated successfully, but these errors were encountered: