knuckleswtf / knuckleswtf/scribe
Example request not adhering to FormRequest Rules
- Dominant language
- PHP
- Stars
- 2.3k
- Forks
- 357
- PR merge metrics
- No merged PRs in 30d
Description
### Scribe version
4.29.0
### PHP version
8.2.15
### Framework
Laravel
### Framework version
v9.52.6
### Scribe config
```ruby
title => "Kuubix Configbox API"
base_url => "http://127.0.0.1:8000"
try_it_out.enabled => false
auth.enabled => true
auth.in => "header"
auth.name => "x-api-key"
strategies.urlParameters => added Knuckles\Scribe\Extracting\Strategies\UrlParameters\GetFromLumenAPI
strategies.headers => added Knuckles\Scribe\Extracting\Strategies\Headers\GetFromRouteRules: removed [
'override',
[
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
strategies.responses => added Knuckles\Scribe\Extracting\Strategies\Responses\ResponseCalls: removed [
'Knuckles\\Scribe\\Extracting\\Strategies\\Responses\\ResponseCalls',
[
'only' => [
'GET *',
],
],
]
```
### What happened?
First off thank you for this package, apart from this bug it's been working flawlessly!
So I have generated my docs and everything seemed to be fine. However it appears that scribe is not adhering to the validation rules when generating the example request?
This is part of our FormRequest, which as you can see has different validation rules applied.

After generating the docs, and looking at the request this is what I see:

So the example request does include the 'articles' but it does not include every single required field. When looking at the actual specification besides it:

You can see that in this case scribe does seem to recognize that 'name' and 'price_excl' are required fields, but this is not reflected in the generated example.
I do know I could just give my own example and that would solve this. But it does appears that this is a bug? Unless I'm doing something wrong on my side.
Again thank you for all the work on this, it makes our lives a lot easier!
### 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
Reproduce the generated example request using the reported Laravel FormRequest rules and compare it with the specification shown in the issue. Trace how required fields are extracted for the example request; done when fields such as name and price_excl appear in the generated request whenever the specification marks them as required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- laravel, php
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100