-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
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
Omit non-Object meta #124
Omit non-Object meta #124
Conversation
…refore not an object, as the specification requires. Cf. http://jsonapi.org/format/#document-meta Where specified, a meta member can be used to include non-standard meta-information. The value of each meta member MUST be an object (a “meta object”).
…map rather than not nil
I think this is a bugfix rather than an enhancement as |
Thank you and welcome @kbaird 😁 I've corrected the label |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Seen this a lot but never knew it was a bug!
@@ -117,8 +117,7 @@ defmodule JSONAPI.QueryParser do | |||
requested_fields = | |||
value | |||
|> String.split(",") | |||
|> Enum.map(&String.to_atom/1) | |||
|> Enum.into(MapSet.new()) | |||
|> Enum.into(MapSet.new(), &String.to_atom/1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
The serializer was including
meta
even in cases where its value would not be an Object, which is not in compliance with the JSONAPI spec (http://jsonapi.org/format/#document-meta). This PR makes the serializer omit themeta
whenis_map(meta)
isfalse
.I also DRYed up the tests, since my added ones re-used some of the existing default data.