knuckleswtf / knuckleswtf/scribe
suppressing FormRequest attributes added in prepareForValidation
- Dominant language
- PHP
- Stars
- 2.3k
- Forks
- 357
- PR merge metrics
- No merged PRs in 30d
Description
### Scribe version
4.29.0
### Your question
We have an API endpoint with a FormRequest that takes a filename as input.
In `prepareForValidation()`, we do `$this->merge(['extension' => pathinfo($this->input('filename'), PATHINFO_EXTENSION)]);` to determine the file extension. We then validate the resulting `extension` value in the `rules()` function.
In the resulting documentation, the `extension` parameter shows up, which makes readers think it can/should be sent instead of being computed for validation purposes as it actually is. Is there a way to suppress this attribute from the resulting documentation?
### Docs
- [X] I've checked [the docs](https://scribe.knuckles.wtf/laravel), the [troubleshooting guide](https://scribe.knuckles.wtf/laravel/troubleshooting), and [existing issues](https://github.com/knuckleswtf/scribe/issues?q=is%3Aissue+), but I didn't find a solution
Contributor guide
Research direction
Start by tracing how Laravel FormRequest fields are collected after prepareForValidation() and how those fields become generated documentation. Check whether the extension attribute can be excluded while the filename remains documented. Done means computed validation-only attributes are omitted from the resulting documentation, with the behavior verified in the relevant documentation output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- laravel, php
- Domain
- backend, documentation
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100