Online editor reports several nonsensical errors
See original GitHub issueBug
Q | A |
---|---|
Bug or feature request? | Bug |
Which Swagger/OpenAPI version? | 3.0.0 |
Which Swagger-Editor version? | 3.1.9 |
How did you install Swagger-Editor? | npm i -S swagger-editor-dist |
Which broswer & version? | chrome 62 |
Which operating system? | ubuntu 17.04 |
Demonstration API definition
openapi: 3.0.0
info:
title: Example API
description: Service API.
version: 1.0.0
servers:
- url: 'http://api.example.com'
paths:
/login/local:
post:
tags:
- login
summary: Login using email or nickname
description: Returns customer info and jwt access and refresh tokens
security:
- apiKey: []
requestBody:
content:
application/json:
schema:
type: object
properties:
emailOrNickname:
type: string
required: true
password:
type: string
required: true
responses:
'200':
description: Login successful
content:
application/json:
schema:
type: object
properties:
customer:
$ref: "#/components/schemas/Admin"
refreshToken:
type: string
"401":
description: "Unauthorized"
components:
securitySchemes:
apiKey:
type: apiKey
in: header
name: x-application-key
schemas:
Admin:
type: object
properties:
_id:
type: string
name:
type: object
properties:
first:
type: string
last:
type: string
email:
type: object
properties:
address:
type: string
verified:
type: boolean
token:
type: string
password:
type: string
recoveryToken:
type: string
lastLogin:
type: string
format: date-time
Configuration (browser query string, constructor, config.yaml)
I’m using the default config
const editor = SwaggerEditorBundle({
dom_id: '#swagger-editor',
layout: 'StandaloneLayout',
presets: [
SwaggerEditorStandalonePreset
]
})
Expected Behavior
I think my path definition is correct. I’ve read and re-read the 3.0 spec several times, I based my code on the examples on spec but I still get several weird errors: Mainly I don’t want to use a component $ref
on the requestBody
. I’ve seen example code on the spec documentation and it looks like I should have that option
Current Behavior
Errors
Hide
Schema error at paths['/login/local'].post.requestBody
should have required property '$ref'
missingProperty: $ref
Jump to line 17
Schema error at paths['/login/local'].post.requestBody
should match exactly one schema in oneOf
Jump to line 17
Schema error at paths['/login/local'].post.requestBody.content['application/json']
should have required property 'examples'
missingProperty: examples
Jump to line 19
Schema error at paths['/login/local'].post.requestBody.content['application/json']
should match exactly one schema in oneOf
Jump to line 19
Schema error at paths['/login/local'].post.requestBody.content['application/json'].schema
should have required property '$ref'
missingProperty: $ref
Jump to line 20
Schema error at paths['/login/local'].post.requestBody.content['application/json'].schema
should match exactly one schema in oneOf
Jump to line 20
Schema error at paths['/login/local'].post.requestBody.content['application/json'].schema.properties['emailOrNickname']
should have required property '$ref'
missingProperty: $ref
Jump to line 23
Schema error at paths['/login/local'].post.requestBody.content['application/json'].schema.properties['emailOrNickname']
should match exactly one schema in oneOf
Jump to line 23
Schema error at paths['/login/local'].post.requestBody.content['application/json'].schema.properties['emailOrNickname'].required
should be array
Jump to line 25
Schema error at paths['/login/local'].post.requestBody.content['application/json'].schema.properties['password']
should have required property '$ref'
missingProperty: $ref
Jump to line 26
Schema error at paths['/login/local'].post.requestBody.content['application/json'].schema.properties['password']
should match exactly one schema in oneOf
Jump to line 26
Schema error at paths['/login/local'].post.requestBody.content['application/json'].schema.properties['password'].required
should be array
Jump to line 28
Context
I’m trying to migrate some bad documentation to something better using swagger 3
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to correct website and social media errors effectively
Attempts to minimize or obfuscate the mistake can render a correction confusing, or meaningless. It also compounds the damage.
Read more >Scammers impersonate guest editors to get sham papers ...
Hundreds of junk-science papers have been retracted from reputable journals after fraudsters used 'special issues' to manipulate the ...
Read more >Error monitoring and exception handling in large-scale ...
Learn how to handle errors and exceptions on large scale software projects, with best practices, tools and tips.
Read more >How to design error messages for humans - Editor X
Pro tips to elevate your error message from a nuisance to an empowering part of your user experience. Here's how to write and...
Read more >10 Common Mistakes Journalists Make (& How To Avoid Them)
Letting people know about errors can let someone know to fix it. If you've seen a mistake online or print: Contact the editor....
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
Nevermind. I found out what breaks it. It is that I was using a
required: boolean
parameter inside a SchemaObject. I got confused with old swagger syntax. the correct syntax is:Thanks for reporting the issue and the fix. I’m going to reopen the ticket since we need to rework that validation message. It’s not useful to users and we should do a better job at it.