42Crunch / intellij-openapi-editor

OpenAPI (Swagger) Editor plugin for IntelliJ
9 stars 0 forks source link

Support for OpenAPI release 3.1.0 #5

Open kentmchenry opened 3 years ago

kentmchenry commented 3 years ago

There is a new release of OpenAPI (3.1.0). The regex for validating the version marks this as invalid.

https://github.com/OAI/OpenAPI-Specification/releases

ak1394 commented 3 years ago

Thanks for the feedback! We plan to support 3.1.0 in the future versions of the extension, but supporting it requires more than simply fixing a version check. For instance we rely on OpenAPI JSON Schema to do the validation, which is not yet available for 3.1.0.

ghost commented 3 years ago

Hi, the components/pathItems is supported beginning 3.1 . Currently in plugin 1.13 it is not a valid entry. (https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsObject)

This would greatly simplify the #ref to pathItem object in separate file. In 3.0 only a generic yaml object can be imported. But then the plugin support cannot be utilized on this yaml file.

Thanks for your great plugin

ak1394 commented 3 years ago

Hi @Davetwo !

we surely would like to support 3.1, but something which is stopping us from doing it right now is a support of JSON Schema 2020-12 in IntelliJ.

We use JSON Schemas provided by OpenAPI Initiative to do validation and completion, and the schema for 3.1 is using newer JSON Schema 2020-12 format, which is as far as I know is not yet supported by IntelliJ.

filipeamaral commented 3 years ago

Apparently IntelliJ uses the schemas available at https://www.schemastore.org/json/. Currently the latest JSON Schema version available is Draft 8, aka as 2019-09. So the version missing is the 2020-12 one.

A PR to their GitHub repo would enable this 🙂

@ak1394 Would this do the trick?

ak1394 commented 3 years ago

@filipeamaral unfortunately no, the new schema uses newer "JSON Schema 2020-12" dialect not yet supported by IntelliJ

dan-j commented 3 years ago

Does anyone know if there's an outstanding issue on the Jetbrains issue tracker to support 2020-12 schemas? I've tried searching but can't find anything

ak1394 commented 3 years ago

I'm not sure there is visible issue on the tracker yet, so far we've contacted their support but haven't heard back yet.

ak1394 commented 3 years ago

The issue in IntelliJ tracker is https://youtrack.jetbrains.com/issue/IDEA-275297

ramilmsh commented 2 years ago

@ak1394 maybe you could add a link to the issue tracker in the error message, so that people can like it and, thus, bump its priority

By error message I mean this one:

Unable to render this definition

The provided definition does not specify a valid version field.

Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0).
AlexNik commented 2 years ago

We need 3.1 support for patternProperties. https://github.com/OAI/OpenAPI-Specification/issues/687#issuecomment-590399062

derekwsgray commented 2 years ago

3.1.0 is now over a year old... is there really no way to validate these in the IDE? Am I supposed to disable the JetBrains' bundled openapi plugin when using the 42crunch plugin?

michellemay commented 1 year ago

What is holding up here ? It's been more than two years. In our case, we are not relying on json schema for the models and use yaml instead. So I guess most of the previous comments are not applying to us.

May I propose to fix support for 3.1.0 for yaml files at least?

ak1394 commented 1 year ago

Hi @michellemay ! Unfortunately, the JSON Schema support is central for the 3.1 support. We rely on the IDE to provide validation and auto completion for both JSON and YAML files. So even if you are using YAML, you still rely on JSON Schema.

meden commented 1 year ago

Unfortunately, the JSON Schema support is central for the 3.1 support. We rely on the IDE to provide validation and auto completion

@ak1394, what this does exactly mean? If the support has to be provided by the IDE, is this bug still valid? If it's not only about the IDE, what is needed to be done to have the support for OAS 3.1?

Moreover, it looks that json-schema-org.github.io has been archived on past Oct. 23, and all information are now available on https://json-schema.org/: what now?

As any user can add new JSON schemes in IDEA (in addition to the ones supported out-of-the-box), there is any workaround one could apply? Or could the plugin itself ship/setup the new schema? (This could come in handy for future version, eventually).

And a last question: how using JSON Schema 2020-12 can be enough, if OAS 3.1 is actually using a specific dialect? (Dialect already available on json-schema.org, BTW.)

Sorry for the many questions, but I hope they can somehow help to shed some light on this issue's status, and eventually to get to close it.

ak1394 commented 1 year ago

Hi @meden ! Maybe I should have worded it a bit better, when I talk about "JSON Schema support" in the context of this ticket, I specifically mean the support for the "JSON Schema 2020-12" dialect of it.

OAS 3.1 uses this newer schema dialect which is not currently supported IntelliJ (see this ticket for details https://youtrack.jetbrains.com/issue/IDEA-275297), so this is the issue not the availability of the schemas itself.

Without editor support for this dialect, there is no point of support for 3.1 as things like autocompletion and validation will not work.

meden commented 12 months ago

@ak1394, thanks for the clarification. I guess then it's not enough to add a custom schema (as I actually tried to do), as it would have a more recent JSON schema-version directly supported in IDEA anyway, right?

image

ak1394 commented 12 months ago

@meden Correct! See the details here https://youtrack.jetbrains.com/issue/IDEA-275297