jsonapi-serializers
jsonapi-serializers copied to clipboard
Move default serialize format to camelCase
In the README.md:
# By default, the type is the object's class name lowercased, pluralized, and dasherized,
# per the spec naming recommendations: http://jsonapi.org/recommendations/#naming
However JSONAPI seems to have changed their recommendations to camelCase. https://jsonapi.org/recommendations/#naming
Would be a breaking change so posting an issue about how to approach this before attempting a PR
also even if you override it, included associations are still dashed.
I was also not able to get the unformat_name override to work.
Usage:
class UserSerializer
include JSONAPI::Serializer
def unformat_name(attribute_name)
attribute_name.to_s.underscore
end
attribute :first_name
attribute :last_name
end