Skip to content
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

Client-side generated ID's #20

Closed
batshoes opened this issue Sep 30, 2019 · 2 comments
Closed

Client-side generated ID's #20

batshoes opened this issue Sep 30, 2019 · 2 comments

Comments

@batshoes
Copy link
Contributor

batshoes commented Sep 30, 2019

Er, hello. It's me again.

I'd like to discuss the addition of :id in the translated params hash.
https://jsonapi.org/format/#crud-creating-client-ids

Our app and use case requires the inclusion of Client Generated ID's, and I'm finding that on my create actions I'm having to add params.dig(:data, :id)

I think this is a simple case of merging the id when creating the @jsonapi_unsafe_params and letting the rails controller whitelist do the stripping if necessary. i.e. strong params.

Case for:

  • Shouldn't be the gem's job to remove :id if it's unwanted.

Case against:

  • Unexpected addition of :id poses a security risk for anyone not expecting (and guarding against) it.
@Marahin
Copy link
Collaborator

Marahin commented Oct 21, 2019

Hi!

That must be an interesting use case, and indeed it is something to consider.
It is great to hear feedback about the functionality as initially we started building it to suit our needs.

Thanks for opening the issue, and off I go for PR review :)

@Marahin
Copy link
Collaborator

Marahin commented Oct 31, 2019

The PR has been merged, so I'm closing this. Thanks!

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

No branches or pull requests

2 participants