jsonapi-serializers icon indicating copy to clipboard operation
jsonapi-serializers copied to clipboard

Move default serialize format to camelCase

Open lewisf opened this issue 5 years ago • 2 comments

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

lewisf avatar Aug 08 '19 22:08 lewisf

also even if you override it, included associations are still dashed.

nbw avatar Sep 15 '20 09:09 nbw

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

fdreith avatar Nov 23 '20 00:11 fdreith