-
-
Notifications
You must be signed in to change notification settings - Fork 528
bug: request body fields with default values are treated as required #1741
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
Comments
Hi, @ysemennikov ! The results I generated using your scheme test were correct. |
@phk422 We're seeing this issue as well. Could the difference be that the requestBody is using a referenced component schema rather than an inline schema? |
Ah, yes, I overlooked it. I already submitted a pr to fix it! |
Description
We have generated TS interfaces using our OpenAPI 3.1.0 specification. There are some parameters that have default values (so they are not required in request, and the body without them will be still valid):
However, these parameters are treated as required when generating paths:
openapi-typescript
7.0.1
20.13.1
macOS Sonoma 14.4
Reproduction
Try to use this openapi schema:
You can see that default values are set, but the fields are not recognized as not required.
Expected result
Parameters that have default values have
| undefined
in type declaration, likeChecklist
npx @redocly/cli@latest lint
)The text was updated successfully, but these errors were encountered: