OAS 3.0: schema inheritance overwrites $ref definition
See original GitHub issueQ | A |
---|---|
Bug or feature request? | bug |
Which Swagger/OpenAPI version? | 3.0.0 |
Which Swagger-Editor version? | master |
How did you install Swagger-Editor? | npm + swaggerhub |
Which broswer & version? | safari 10.1.2 |
Which operating system? | OSX |
Demonstration API definition
paths:
/entity.json:
get:
tags:
- entity
summary: List of public entities
operationId: listPublicEntities
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/EntityListResponse'
'400':
description: invalid operation
content:
application/json:
schema:
$ref: '#/components/schemas/ExceptionResponse'
components:
schemas:
Response:
type: object
properties:
version:
type: string
ExceptionResponse:
$ref: '#/components/schemas/Response'
# type: object
properties:
exception:
$ref: '#/components/schemas/Exception'
EntityListResponse:
$ref: '#/components/schemas/Response'
# type: object
properties:
entities:
type: array
items:
$ref: '#/components/schemas/Entity'
Exception:
type: object
properties:
message:
type: string
type:
type: string
code:
type: integer
Entity:
type: object
properties:
uuid:
type: string
type:
type: string
title:
type: string
active:
type: boolean
Configuration (browser query string, constructor, config.yaml)
Expected Behavior
EntityListResponse
and ExceptionResponse
should inherit version
field from Response
. EntityListResponse
for HTTP 200 OK should not show any exception properties, but rather Entity
properties.
Current Behavior
EntityListResponse
for 200 OK example shows in the editor as exception:
{
"version": "string",
"exception": {
"message": "string",
"type": "string",
"code": 0
}
}
Possible Solution
Context
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
OpenAPI Specification - Version 3.0.3 - Swagger
Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. ... to reference those parts as follows from the JSON...
Read more >OpenAPI Specification v3.0.3 | Introduction, Definitions, & More
The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs.
Read more >Is there a way to override properties' description and example ...
Note that the following two definitions are identical: Duck: allOf: - $ref: '#/components/schemas/Pet' - type: object properties: no_legs: ...
Read more >Designing REST API with Open API Specification (OAS) v2.0 ...
The schema folder under openapi-3.0 contains the specification file spec.json defined in accordance with OAS v3.0.
Read more >Schema (swagger-annotations 2.1.10 API) - javadoc.io
The annotation may be used to define a Schema for a set of elements of the ... is provided as value of implementation()...
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
@hungnd, make sure your openapi property is
openapi: "3.0.0"
. If that doesn’t solve your problem, feel free to open a new issue and we’ll help out there.It should produce a validation warning that anything other than the $ref will be ignored.