vt-elixir / ja_serializer

JSONAPI.org Serialization in Elixir.
Other
640 stars 148 forks source link

sparse fields option is formatted exactly opposite of what is received by the controller #272

Open doughsay opened 6 years ago

doughsay commented 6 years ago

Using the default dasherized fields, here's an example:

GET "/admin-users?fields[admin-user]=first-name,last-name"

params["fields"] == %{"admin_user" => "first-name,last-name"}

Note: the resource name was underscored, and the field names were left untouched. This I assume is being done by the Deserialize plug.

But the call to render needs exactly the opposite formatting, i.e. it expects: %{"admin-user" => "first_name,last_name"} with the resource name still dasherized and the field names underscored.