Netflix / fast_jsonapi

No Longer Maintained - A lightning fast JSON:API serializer for Ruby Objects.
Apache License 2.0
5.07k stars 425 forks source link

Support for heterogeneous records while serializing #393

Open vivektiwary opened 5 years ago

vivektiwary commented 5 years ago

duplicate of https://github.com/Netflix/fast_jsonapi/issues/225

class Song < ActiveRecord::Base; end
class Pop < Song; end
class Rock < Song; end

class SongSerializer
  include FastJsonapi::ObjectSerializer
  attribute :title
end
class PopSerializer < SongSerializer
  attribute :description
end
class RockSerializer < SongSerializer
  attribute :duration
end

AMS makes automatic lookup and returns JSON with items with different attributes(title, description for PopModel; title, duration for RockModel). Is there any consideration of supporting this?

dvandersluis commented 5 years ago

I am in need of this feature as well, is there any way to help make it happen?