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

Validation rules forces body or query params? #702

Open
1 task done
helgur opened this issue Aug 6, 2023 · 2 comments
Open
1 task done

Validation rules forces body or query params? #702

helgur opened this issue Aug 6, 2023 · 2 comments
Labels
question Further information is requested

Comments

@helgur
Copy link

helgur commented Aug 6, 2023

Scribe version

4.22.0

Your question

I've been trying to solve this issue for the better part of the last 3 hours now. As soon as I use validation rules either in a custom request or the controller itself in laravel scribe insists on tacking on the fields as either query parameters or body parameters, even though I am only using url parameters to pass data through the API endpoint

Are there any solutions to this?

Docs

@helgur helgur added question Further information is requested triage labels Aug 6, 2023
@shalvah
Copy link
Contributor

shalvah commented Aug 7, 2023

Hey, sorry for that. This is a known limitation of Scribe. Most validation rules are for request bodies, so we assume that by default. We're still trying to workshop for a solution: #692 (comment)
Perhaps maybe we can support a magic comment above the validation rules for this.

@shalvah shalvah removed the triage label Aug 7, 2023
@helgur
Copy link
Author

helgur commented Aug 7, 2023

That sounds like a good idea. In the meantime I've just used queryParameters() to override any duplicates and just mark them as placeholders and removing their examples. But it's obviously not ideal.

Another alternative is to remove validation alltogether and just code any validation manually in the controller. But it gets messy and introduces potential for a lot of undocumented stuff, the very thing scribe is meant to help alleviate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants