-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(oas): identify required fields in responses - admin #3278
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
Conversation
🦋 Changeset detectedLatest commit: 454621a 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nice work @patrick-medusajs!
Tested locally ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed missing required fields for these responses, but I'm not sure if there's a reason behind it:
AdminCollectionsDeleteRes
AdminDeleteProductsFromCollectionRes
AdminCustomerGroupsListRes
* required: | ||
* - shipping_options | ||
* - count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also have here offset
and limit
but they're also missing from the response properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch 🎣 . Fixed in 5c3615b
I also added the missing required
on the other schemas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
## Scope Admin routes ## What Add OAS `required` to response schemas. ## Why Code generator can use the `required` property of a schema to mark fields as optional or not when generating TS types. ## Test * Run `yarn build` * Run `yarn openapi:generate` * Run `yarn redocly preview-docs docs/api/admin/openapi.yaml --config=docs-util/redocly/config.yaml` * Open the documentation preview URL in a browser (http://127.0.0.1:8080) * Expect responses to have their fields declared as `required`
Scope
Admin routes
What
Add OAS
required
to response schemas.Why
Code generator can use the
required
property of a schema to mark fields as optional or not when generating TS types.Test
yarn build
yarn openapi:generate
yarn redocly preview-docs docs/api/admin/openapi.yaml --config=docs-util/redocly/config.yaml
required