Path item $refs override inline operations instead of merging
See original GitHub issueQ | 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 $ref
s are not supposed to override their sibling elements.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Using $ref - Swagger
OAS 3 This guide is for OpenAPI 3.0. Using $ref. When you document an API, it is common to have some features which...
Read more >Compound paths and shapes in InDesign - Adobe Support
You can combine several paths into a single object, called a compound path. Create a compound path when you want to do any...
Read more >Review a merge request - GitLab Docs
It allows checking out a merge request by using its ID instead of its branch. Introduced in GitLab 13.4, 14 days after a...
Read more >OpenAPI Specification v3.0.3 | Introduction, Definitions, & More
4.7.9.1 Fixed Fields; 4.7.9.2 Path Item Object Example. 4.7.10 Operation Object ... Individual operations can override this definition.
Read more >How to Edit, Customize, and Override Bootstrap CSS to Suit ...
You can override the default styles of Bootstrap elements using two possible methods. The first way — using CSS overrides— applies to sites ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Skeeve the next version of the OpenAPI Specification, 3.1, will support
$ref
siblings in schemas. Outside of schemas, $refs will allow siblingsummary
anddescription
keywords. In the meantime, the workaround to add extra properties to a schema$ref
is to wrap the$ref
intoallOf
.Hmmm… Could it be, this is correct?