-
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
The example from json file cannot displayed correctly after upgarde Swagger-UI to 3.24.3 #5829
Comments
The current behavior is actually correct because the RegisterConsumerAccountRequest:
description: Consumer registration request payload.
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterConsumerAccountRequest'
examples:
Create customer example:
externalValue: 'create-customer-example.json' However, |
Thank you! |
I think so. |
@wangjiong04 Does it work if you merge the example in as the schema-level "example" instead of using the media-type-level "example"? I am using such a workaround, with the difference that I am referencing components, not files (so I'm not sure if it will work for you). E.g., RegisterConsumerAccountRequest:
description: Consumer registration request payload.
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/RegisterConsumerAccountRequest'
- example:
$ref: 'create-customer-example.json' |
- example:
$ref: 'create-customer-example.json' won't work because This particular scenario - pointing to an external JSON data example - is defined using |
@hkosova While I agree that It is possible this behavior is a bug, but the schema seems ambiguous. Do you think I should open a separate issue about it? OTOH since I'm actively using it, I don't really want it to be fixed. 😬 I just confirmed again with this example (3.24.3), let me know if I am missing something: components:
examples:
SomeBasicType:
value:
is_it_some_text: Yes it is!
schemas:
SomeBasicType:
type: object
properties:
is_it_some_text:
type: string
/some/route:
post:
requestBody:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/SomeBasicType'
- example:
$ref: '#/components/examples/SomeBasicType/value' |
Q&A (please complete the following information)
Content & configuration
Swagger/OpenAPI definition:
Before upgraded, our Swagger-UI is 3.22.1, all the display are correct
After we upgraded to 3.24.3, the examples are disappeared but we didn't change any other thing
The text was updated successfully, but these errors were encountered: