-
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
OpenAPI 3.1.: examples in webhooks are being overwritten by the examples in schema #9937
OpenAPI 3.1.: examples in webhooks are being overwritten by the examples in schema #9937
Comments
We're not getting the new
It looks like a problem with not re-rendering the parent component - I could see that the path re-renders swagger-ui/src/core/components/parameters/parameters.jsx Lines 245 to 249 in 9037acf
but I could not find why it doesn't do so for the webhook. A fix for this could be to get the examples key in const examplesKey = activeExamplesKey || mediaTypeValue.get("examples")?.keySeq().first()
const mediaTypeExample = hasExamplesKey
? mediaTypeValue.getIn([
"examples",
examplesKey,
"value"
])
: exampleSchema but this might only be patching over the actual issue. I've also noticed while testing that choosing examples does not work for webhooks, both in request body and in response. |
The issues is here:
SpecPath always needs to be unstable to always trigger the re-render of |
Addressed in #9938 |
Q&A (please complete the following information)
Content & configuration
Example Swagger/OpenAPI definition:
Describe the bug you're encountering
In webhooks the specified examples are being overwritten by the examples from the schema defined in the same content type, despite the example chosen in the dropdown:
This does not happen for paths - the example values are correctly rendered from the chosen example and not from the schema:
Additionally, if I first expand the webhook, I will see the example from the schema. Expanding the path after that will show the correct example there and also overwrite the example in webhook to the correct one:
This will not happen if I first expand the path and then the webhook:
Also, expanding, collapsing and then expanding the webhook again will show the correct example as well.
To reproduce...
Steps to reproduce the behavior:
Expected behavior
The displayed example should be the one defined in examples / selected in the dropdown.
The text was updated successfully, but these errors were encountered: