scribe
scribe copied to clipboard
Validation rules forces body or query params?
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
- [X] I've checked the docs, the troubleshooting guide, and existing issues, but I didn't find a solution
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: https://github.com/knuckleswtf/scribe/issues/692#issuecomment-1615197321 Perhaps maybe we can support a magic comment above the validation rules for this.
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