We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyFormat breaks included relationships when the relationship's name is subject to key transformation.
KeyFormat
class Resource < JSONAPI::Serializable::Resource extend JSONAPI::Serializable::Resource::KeyFormat key_format ->(key) { key.to_s.camelize(:lower) } end
class ContactResource < Resource type 'contacts' has_many :contact_groups attributes :first_name, :last_name, :email # , ... end
class ContactGroupResource < Resource type 'contactGroups' attributes :name end
Results in the relationship key to be transformed but related resources don't get included:
{ "id": "046ffaf3-9c7b-4f36-a33b-1948cb889200", "type": "contacts", "attributes": { "firstName": "John", "lastName": "Doe", "email": '[email protected]' }, "relationships": { "contactGroups": { "meta": { "included": false } } } }
Without using KeyFormat it works as expected:
{ "id": "046ffaf3-9c7b-4f36-a33b-1948cb889200", "type": "contacts", "attributes": { "first_name": "John", "last_name": "Doe", "email": '[email protected]', }, "relationships": { "contact_groups": { "data": [ { "type": "contactGroups", "id": "c88e3a19-f814-49d9-a458-40c2103f0003" } ] } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
KeyFormat
breaks included relationships when the relationship's name is subject to key transformation.Results in the relationship key to be transformed but related resources don't get included:
Without using
KeyFormat
it works as expected:The text was updated successfully, but these errors were encountered: