Skip to content

Fix JSONApi sparse fieldset compliance for relationships - #203

Merged
doomspork merged 2 commits into
beam-community:masterfrom
leepfrog:fix-resource-fields
May 14, 2019
Merged

Fix JSONApi sparse fieldset compliance for relationships#203
doomspork merged 2 commits into
beam-community:masterfrom
leepfrog:fix-resource-fields

Conversation

@leepfrog

Copy link
Copy Markdown

Changes:

Relevant section from the spec: "A client MAY request that an endpoint return only specific fields in the response on a per-type basis by including a fields[TYPE] parameter."

@jherdman jherdman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! A few notes on making this safe to release ASAP.

Comment thread test/jsonapi/plugs/query_parser_test.exs
Comment thread lib/jsonapi/plugs/query_parser.ex Outdated
Comment thread test/jsonapi/plugs/query_parser_test.exs Outdated
@leepfrog

Copy link
Copy Markdown
Author

Thx! Will make these changes and update this PR shortly.

@leepfrog
leepfrog force-pushed the fix-resource-fields branch from 497242a to e7747a1 Compare May 10, 2019 15:41
end
end

@spec is_field_valid_for_relationship({atom(), module()}, String.t()) :: boolean()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the simplest way I could think of to handle the deprecation, but happy to take suggestions if needed.

@jherdman
jherdman requested a review from doomspork May 14, 2019 01:19
@leepfrog
leepfrog force-pushed the fix-resource-fields branch from e7747a1 to 0784120 Compare May 14, 2019 19:31
Andy Tran added 2 commits May 14, 2019 12:32
  instead of relationship name.

  see: https://jsonapi.org/format/#fetching-sparse-fieldsets

- query_parser_test: fix a typo in test relationship definition
@leepfrog
leepfrog force-pushed the fix-resource-fields branch from 0784120 to 6e9e9a6 Compare May 14, 2019 19:32

@doomspork doomspork left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this @leepfrog!

@doomspork
doomspork merged commit 2e59cfa into beam-community:master May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants