swagger-api / swagger-api/swagger-ui
Path item $refs override inline operations instead of merging
Nobody has claimed this yet.
- 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? | 2.0, 3.0.0 |
| Which Swagger-UI version? | 3.2.0 |
| How did you install Swagger-UI? | http://editor.swagger.io |
| Which browser & version? | Chrome 61 |
| Which operating system? | Windows 7 |
Demonstration API definition
2.0 spec:
swagger: '2.0'
info:
version: 0.0.0
title: Path item $ref test
paths:
/foo:
get:
responses:
200:
description: OK
/foo2:
$ref: '#/paths/~1foo'
post:
summary: Create a foo2
responses:
201:
description: Created
3.0 spec:
openapi: 3.0.0
info:
version: 0.0.0
title: Path item $ref test
paths:
/foo:
get:
responses:
'200':
description: OK
/foo2:
$ref: '#/paths/~1foo'
post:
summary: Create a foo2
responses:
'201':
description: Created
Expected Behavior
/foo2 displays both GET (added by $ref) and POST (defined inline).
Current Behavior
/foo2 displays GET only.
Context
According to https://github.com/OAI/OpenAPI-Specification/issues/1038#issuecomment-295594246, when a path item contains a $ref, the referenced operation is added (merged) to other operations in this path. Unlike regular JSON references, path item $refs are not supposed to override their sibling elements.
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.
Research direction
Start by reproducing the issue in Swagger UI with the 2.0 and 3.0.0 API definitions shown in the report, focusing on how the /foo2 path item is resolved. Done means /foo2 displays both the referenced GET operation and its inline POST operation instead of only GET.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100