-
-
Notifications
You must be signed in to change notification settings - Fork 602
Add option to handle parameters with default as non-optional #2528
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
base: main
Are you sure you want to change the base?
Conversation
👷 Deploy request for openapi-ts pending review.Visit the deploys page to approve it
|
🦋 Changeset detectedLatest commit: 5d314f4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
if respective option is set
7eb397e to
3f0607e
Compare
|
Test failure seems unrelated, docly have refactored their tests and moved a bunch of files: Redocly/redocly-cli@cf26d60#diff-819418d7530fd6a1220968de72601d679939eb5a01c3b9cc9e388050bd58ff77 |
f3dcc2e to
0f11d02
Compare
Changes
This PR introduces a new option that makes it possible to request that non-required parameters still be generated as non-optional (no question token) if they have a default value set in their schema.
This allows to generate types for certain server implementation use where the default value is injected automatically for the handling function to consume (I am working on one atm) and the signature on the handler should indicate that the value can not be undefined.
This makes it so that the default value can be derived and set by the framework from the openapi spec and does not need to be repeated by the person implementing the operation.
Fixes #2319
Checklist
docs/updated (if necessary)pnpm run update:examplesrun (only applicable for openapi-typescript)