syntax sugar `render` like other serializers
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.
this would be great!
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.