-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
Required fields from rules() are not parsed into OpenAPI file #916
Comments
I think that's fixed by #905. I'll try to tag a release soon. |
I'm not sure it I should create a new issue or just add the feedback here. We are facing the same issue with the Scribe version PHP version Framework Framework version Scribe config 'type' => 'external_static',
// See https://scribe.knuckles.wtf/laravel/reference/config#theme for supported options
'theme' => 'elements', Rules public function rules(): array {
return [
'meta.creation-date' => ['required', new Iso8601()],
'data.*.creation-date' => ['required', new Iso8601()],
];
} OpenAPI requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
meta:
type: object
description: ''
nullable: false
properties:
creation-date:
type: string
description: ''
example: et
nullable: false
required: // Line is missing
- creation-date // Line is missing
data:
type: array
description: ''
example:
- []
items:
type: object
properties:
creation-date:
type: string
description: ''
example: magni
nullable: false
required:
- creation-date
security: [] Expected behaviour: I tried to understand the logic how a required parameter is extracted, set and written into the OpenAPI spec, but seems to be a little to complex. |
@AryaSvitkona There is an indentation error in your yaml
|
@torgeros That may be true, but that line was added to point to the issue ;) |
@shalvah can we reopen this issue or should I add a new one? |
Please open a new issue, thanks 🙏 |
Scribe version
4.38.0
PHP version
8.3.10 (cli)
Framework
Laravel
Framework version
10.48.20
Scribe config
What happened?
I have
rules()
that should tag object members asrequired
.For the generated scribe html file, everything not-required is correctly tagged as optional.
However, the generated openapi.yaml does not set required for all fields that are not optional.
Interestingly, member of objects in objects do not seem to work, while members of objects in arrays do.
Nested Object case (does not work)
This is a section of my rules function:
This is the generated (& rendered) OpenAPI document:
And this is what I would expect (I changed the openapi doc manually):
Array of Objects case (does work!)
rules()
snippet:Generated OpenAPI doc:
Docs
The text was updated successfully, but these errors were encountered: