The swagger editor does not seem to be parsing OAS3 responses correctly.
I have the following yaml:
swagger: '2.0'
info:
title: Document converter api
description: An api for running documents through libera office
version: 1.0.0
host: '--'
schemes:
- https
basePath: /v1
produces:
- application/json
paths:
"/document/convert":
post:
description: Post the location of the document you wish to convert and the location to place that document.
consumes:
- "application/vnd.api+json"
parameters:
-
in : body
name : body
description : Post a document to be converted
required : true
schema:
"$ref": "#/definitions/Job"
responses:
200:
description: Response on valid request
content:
application/json:
schema:
"$ref": "#/components/schemas/Success"
400:
description: Response invalid
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
404:
description: File not found
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
definitions:
Job:
type : object
description: Details of the conversion job to run
properties:
links :
$ref : '#/definitions/Link'
type :
type : string
data:
type : object
properties:
attributes:
type: array
items:
type: object
properties:
from:
$ref: "#/definitions/FileLocation"
to:
$ref: "#/definitions/FileLocation"
FileLocation:
type: object
description: Location of a file on google bucket, to either update, remove, copy, create
properties:
bucket:
type: string
location:
type: string
Link:
description: Link to a related end point, which also includes the current endpoint
type: object
properties:
self:
type: string
related:
type: array
items:
type: string
components:
schemas:
Success:
description: Standard responses to api access
type: object
properties:
link:
$ref : '#/definitions/Link'
data:
type: object
properties:
type:
type: string
attributes:
type: array
items:
$ref : '#/definitions/FileLocation'
Error:
description: Error object outlining issues with request
type: object
properties:
status:
type: string
code:
type: string
source:
type: array
items:
type: object
properties:
pointer :
type : string
title:
type: string
detail:
type: string
However when its parsed I get the following errors:
Schema error should NOT have additional properties
additionalProperty: components
Jump to line 0
Schema error at paths['/document/convert'].post.responses['200']
should NOT have additional properties
additionalProperty: content, description
Jump to line 27
Schema error at paths['/document/convert'].post.responses['400']
should NOT have additional properties
additionalProperty: content, description
Jump to line 33
Schema error at paths['/document/convert'].post.responses['404']
should NOT have additional properties
additionalProperty: content, description
Jump to line 39
I am following the standard on responses outlined here https://swagger.io/docs/specification/describing-responses/
Not sure if its just me doing something wrong or i need to flag OAS3 some how.
You might want to start with the basic structure:
https://swagger.io/docs/specification/basic-structure/
swagger: '2.0'
is not OAS3
Ah, I based what I have on the pet shop example. Will look over this.
Most helpful comment
Ah, I based what I have on the pet shop example. Will look over this.