swagger-editor: SwaggerEditor@next: false positive in linting JSON Schema
Q&A (please complete the following information)
- OS: macOS
- Browser: Chrome
- Version: 111.0.5563.110
- Method of installation: None. This is at https://editor-next.swagger.io/
- Swagger-UI version: Unknown
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Example Swagger/OpenAPI definition:
openapi: 3.0.3
info:
title: Test
version: 1.0.0
components:
schemas:
ObjectOne:
type: object
properties:
propertyOne:
type: string
ObjectTwo:
type: object
properties:
propertyTwo:
type: string
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ObjectOne'
- $ref: '#/components/schemas/ObjectTwo'
required: true
responses:
'204':
description: Successful operation
Swagger-UI configuration options: None
Describe the bug you’re encountering
The editor shows an error on line 23 saying, “oneOf must be a non-empty array of schemas” but it is an array of schemas.
To reproduce…
Steps to reproduce the behavior:
- Go to https://editor-next.swagger.io/.
- Enter the YAML above.
- See error.
Expected behavior
No errors or warnings.
Screenshots
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 8
- Comments: 16 (8 by maintainers)
Commits related to this issue
- fix(ls): temporary quick fix false positive for schema reference Refs https://github.com/swagger-api/swagger-editor/issues/3722 Refs https://github.com/swagger-api/swagger-editor/issues/4026 — committed to swagger-api/apidom by frantuma a year ago
- fix(ls): temporary quick fix false positive for schema reference Refs https://github.com/swagger-api/swagger-editor/issues/3722 Refs https://github.com/swagger-api/swagger-editor/issues/4026 — committed to swagger-api/apidom by frantuma a year ago
It looks like the main issue is with
allOf,oneOfandanyOfkeywords. I’ll try to see if I can provide a quick bug fix for those (without doing all the lengthy consolidation effort).Yes, its working perfect now! Thanks @char0n.
Is this really fixed? I’ve tested on https://editor-next.swagger.io/ the example usage of the
oneOfpresented in the docs:Still giving the same error:
I have the same issue too. It also happens with
allOf.