-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Support dropdown for discriminator #10224
base: master
Are you sure you want to change the base?
Conversation
@@ -357,6 +357,7 @@ export default class ParameterRow extends Component { | |||
getConfigs={ getConfigs } | |||
isExecute={ isExecute } | |||
specSelectors={ specSelectors } | |||
specActions={ specActions } |
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.
Is there a better way to get specAction down to model-wrapper.jsx than plumbing it down everywhere like this? I couldn't find a context provider with specActions in the hierarchy
@@ -2,7 +2,8 @@ | |||
{ | |||
font-size: 12px; | |||
font-weight: 300; | |||
|
|||
display: block; |
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.
for OAS 3.0.X, the model is inline with the dropdown if we don't specify this
Fixes #2438 and adds a dropdown to select between schemas that extend a base schema via allOf with discriminator
Sample spec:
spec.json
Description
Motivation and Context
OpenAPI spec supports inheritance via allOf and discriminator, but currently in Swagger UI when you reference a schema that is extended with allOf, there's no indication of this inheritance and valid child schemas a user can input. Provides a poor user experience for specs that rely on this kind of structure
This works in other tools like Redoc: https://github.com/Rebilly/ReDoc/blob/master/docs/images/discriminator-demo.gif
Fixes #2438. Solves a very common allOf usecase, some examples in the OAS 3.1.1 official spec
How Has This Been Tested?
I've manually tested this change using the attached sample spec. I tested for both 3.0 and 3.1. I tested a spec with no explicit mappings, all explicit mappings, and a mix
spec.json
Ran all existing unit tests successfully. Tried to run
npm run e2e
as the README.md says, but no script e2e existsScreenshots (if appropriate):
Checklist
My PR contains...
src/
is unmodified: changes to documentation, CI, metadata, etc.)package.json
)My changes...
Documentation
Automated tests