-
Notifications
You must be signed in to change notification settings - Fork 9.1k
fix(oas3): get examples for oneOf and anyOf in request body #9754
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
The current code for getting initial values for request body and for content types There, if we don't have an example, we won't be generating one, unless the type of the parameter is an object. We can see this in the screenshot, where the only parameter that has an example defined in the schema is the username: ![]() To replicate this behaviour, we only get the initial value if we have an object parameter or an example in the schema: swagger-ui/src/core/plugins/oas3/components/request-body.jsx Lines 176 to 181 in 3a78973
We need an additional check for arrays with examples, as swagger-ui/src/core/plugins/oas3/components/request-body.jsx Lines 186 to 188 in 3a78973
For objects, I think that this is there in case if swagger-ui/src/core/plugins/oas3/components/request-body.jsx Lines 183 to 185 in 3a78973
If we want to move to use swagger-ui/src/core/plugins/oas3/components/request-body.jsx Lines 158 to 160 in 3a78973
The behaviour between the form for parameter in query etc. and for request body would be different. On the other hand, we would also align the initial value with the value we get for |
Only setting these values isn't enough, as we pass swagger-ui/src/core/plugins/oas3/components/request-body.jsx Lines 210 to 222 in 3a78973
Example usage in swagger-ui/src/core/components/json-schema-components.jsx Lines 74 to 77 in 3a78973
It looks like we would need to set anyOf/oneOf schemas as |
Superseded by #9762 |
Refs #9745