swagger-api / swagger-api/swagger-ui
Multiple responses using oneOf attribute do not appear in UI
Open
@shockey is already working on this.
Since Dec 4, 2017.
needs: UX/design input
specification: 3.x
type: feature
version: 3.x
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
| Q | A |
|---|---|
| Bug or feature request? | Bug |
| Which Swagger/OpenAPI version? | |
| Which Swagger-UI version? | |
| How did you install Swagger-UI? | |
| Which browser & version? | |
| Which operating system? |
Demonstration API definition
responses:
'200':
description: OK
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/AuthorisationResponse'
- $ref: '#/components/schemas/ForbiddenResponse'
Configuration (browser query string, constructor, config.yaml)
constructorConfig contains just the default values.
Expected Behavior
Since I have two schemas passed in as a $ref to the 200 response I would expect to see two schemas in the Swagger UI application.
Current Behavior
Instead I see only the reference to the 200 response and its description with no example responses displayed as JSON in the black boxes.
Possible Solution
Context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.