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

Add rule objects to validate resource IDs in query parameters #237

Open
lindyhopchris opened this issue Apr 22, 2023 · 0 comments
Open

Add rule objects to validate resource IDs in query parameters #237

lindyhopchris opened this issue Apr 22, 2023 · 0 comments
Assignees

Comments

@lindyhopchris
Copy link
Contributor

For example, for cursor pagination that uses resource IDs we need some rule objects that use the Laravel JSON:API implementation to validate those IDs. I.e. we have the ID pattern to match against, we have the encoding/decoding of IDs, and then we can actually check whether those IDs exist too.

An example of cursor pagination validation as it exists at the moment woud be:

  'page.after' => 'filled|string|exists:lessons,id',
  'page.before' => 'filled|string|exists:lessons,id',

In this example, it doesn't work if the resource IDs are encoded as Laravel's exists rule doesn't know that the value it is given needs to be decoded before the database is queried.

Originally posted by @othneildrew in #201 (comment)

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

1 participant