Redocly / redocly-vs-code

Redocly VS Code extension
36 stars 8 forks source link

OpenAPI file with version other than 3.1.0 is marked invalid by editor #3

Closed kcchu closed 2 years ago

kcchu commented 2 years ago

What happened?

A specification file with OpenAPI version set to 2.x or 3.0.x is marked as invalid.

What should have happened instead?

OpenAPI 2., 3.0 and 3.1 should be supported as described in the extension description. The validation rules should reflect the version specified in the file automatically.

Screenshots

image

Additional context

Extension version: Release 0.1.0 (2021-11-18) VS Code version: Version: 1.63.0-insider

ivana-isadora commented 2 years ago

Thanks for the report!

Looking at your screenshot, it seems that the warning message you're seeing ("String does not match...") is not coming from the Redocly extension. Something else called yaml-schema is causing this.

If the warning was reported by our extension, it would say "Redocly OpenAPI" instead of "yaml-schema", like in this screenshot: Screenshot_20211202_184658

Are you using some other OpenAPI-related extensions? Perhaps you can try to disable them temporarily, then reload VS Code and see if you're still getting the same warning.

kcchu commented 2 years ago

You are right. The error was produced by the redhat.vscode-yaml plugin instead. Thanks

jeremyfiel commented 2 years ago

openapi: 2.0.0 is invalid too. it should be swagger: 2.0.0

OR

openapi: 3.0.0 openapi: 3.0.1 openapi: 3.0.2 openapi: 3.0.3 openapi: 3.1.0

An OpenAPI document compatible with OAS 3.. contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

https://github.com/OAI/OpenAPI-Specification/tree/main/versions