You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenAPI 3: When a response shows an example, it shows one generated from the schema. It does not show the example that was given under content/type/response/value.
Q
A
Bug or feature request?
Bug
Which Swagger/OpenAPI version?
OpenAPI 3.0
Which Swagger-UI version?
3.13.2
How did you install Swagger-UI?
Git clone
Which browser & version?
Chrome Latest
Which operating system?
MacOS Sierra
Demonstration API definition
openapi: 3.0.0servers:
- url: 'https://__host__/'info:
description: Test APIversion: '1.0'title: Test APIcontact:
name: Sample Personemail: [email protected]tags:
- name: Test API with Schemadescription: Test API with Schemapaths:
/myApi/v1/associates/documents:
get:
operationId: some guidresponses:
'200':
description: Returns documentscontent:
'*.*':
schema:
$ref: ./schemas/documents_schema.jsonapplication/json:
examples:
response:
value: ./examples/document_sample.jsondescription: Returns documentstags:
- Test API with Schemasummary: Test API with Schema
Expected Behavior
Expect the sample to be shown under the example tab in the response.
Current Behavior
A sample that has been generated from the schema is shown. This will show generic types such as "string" as a value rather than a realistic value as used in a sample.
Possible Solution
In core/components/response.jsx, the examples selector (response.get("examples") ) does not pick up all possible examples so subsequent code falls back to a generated version.
This can possibly fixed by modifying response.jsx at about line 108 (inside the "if isOAS3" block) to look a little harder for the examples. Like this:
This is done to avoid resurrecting old issues and bumping long threads with new, possibly unrelated content.
If you think you're experiencing something similar to what you've found here: please open a new issue, follow the template, and reference this issue in your report.
OpenAPI 3: When a response shows an example, it shows one generated from the schema. It does not show the example that was given under content/type/response/value.
Demonstration API definition
Expected Behavior
Expect the sample to be shown under the example tab in the response.
Current Behavior
A sample that has been generated from the schema is shown. This will show generic types such as "string" as a value rather than a realistic value as used in a sample.
Possible Solution
In core/components/response.jsx, the examples selector (response.get("examples") ) does not pick up all possible examples so subsequent code falls back to a generated version.
This can possibly fixed by modifying response.jsx at about line 108 (inside the "if isOAS3" block) to look a little harder for the examples. Like this:
Context
We need to provide examples with realistic values rather than generic generated ones.
The text was updated successfully, but these errors were encountered: