Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OpenAPI 3.1 #378

Closed
BorisBeast opened this issue May 7, 2021 · 12 comments
Closed

Support OpenAPI 3.1 #378

BorisBeast opened this issue May 7, 2021 · 12 comments

Comments

@BorisBeast
Copy link

Are there any plans to support OpenAPI v3.1? If yes when can we expect it?

If nothing else it will allow exploded arrays for multipart/form-data requests which is the default behavior of MultipartParser.
https://spec.openapis.org/oas/v3.1.0#fixed-fields-12

@tfranzel
Copy link
Owner

tfranzel commented May 7, 2021

hi @BorisBeast, the plan is definitely there. imho SwaggerUI and openapi-generator are the main usages of spectacular and and the last time i looked they had not added support yet. i kind of waited for them to move first.

swagger-api/swagger-ui/issues/5891

OpenAPITools/openapi-generator/issues/9083

in any case, some of the new feature may take a while to implement as the move to JSON schema in the new specification has quite a few smaller and bigger implications.

@tfranzel
Copy link
Owner

tfranzel commented Oct 6, 2021

small update:

  • jsonschema, our validation dependency received an update to support Draft 2020-12 (required for 3.1)
  • our whole test suite is green wrt. OpenAPI 3.1 validation (iff 3.0.3 is replaced with 3.1.0)
  • SwaggerUI will add support in 4.x.x
  • Redoc has added preliminary support
  • openapi-generatorI'm not sure about their current state.

With all the changes in OpenAPI 3.1, I currently only see a potential issue with the change in semantics for readOnly/writeOnly (they are deferred to JSON Schema). Apart from that I don't see many roadblocks ahead.

That said, I decided to wait a little longer with adoption. Firstly, drf-spectacular is not very useful without a working ecosystem around it. Secondly, we do not simply implement OpenAPI without any context. We intentionally refrain from using certain valid constructions, which have shown to create problems with other tools. Not every valid schema will be properly handled by UIs or code generators. That practical aspect is very important to drf-spectacular and it's probably best to wait a bit longer until the dust has settled in the ecosystem.

@johnthagen
Copy link
Contributor

That practical aspect is very important to drf-spectacular and it's probably best to wait a bit longer until the dust has settled in the ecosystem.

I'm excited for OpenAPI 3.1 but I too think it is pragmatic to wait a while for the rest of the ecosystem to catch up.

@raianul
Copy link

raianul commented Jan 3, 2022

Hello @johnthagen

I am getting this error, any idea how to fix this?
kson

so far my understanding its required OpenAPI 3.0.

@johnthagen

This comment has been minimized.

@raianul

This comment has been minimized.

@tfranzel
Copy link
Owner

tfranzel commented Jan 3, 2022

@pranto157 this issue is dedicated to OpenAPI 3.1. your issue is unrelated.

@Fares-Abubaker
Copy link

Hello all , @tfranzel

did you add the support for OpenAPI 3.1?
and what about the Json Schema Draft 2020 ?

@mateokurti mateokurti mentioned this issue Dec 18, 2023
@tfranzel
Copy link
Owner

tfranzel commented Jan 6, 2024

we released 0.27.0, which is the first version to support 3.1

I'm not exactly sure how to answer your second question @Fares-Abubaker. 3.1 was made to be JSON Schema compatible. So by definition if a schema is OpenAPI 3.1, it has to be JSON Schema compatible. The differences are small anyway and we only adapted what was conflicting with conformity.

Is there anything missing? I'll close this issue as I consider this resolved. If anything else is missing, please feel free to open a new issue.

@tfranzel
Copy link
Owner

tfranzel commented Jan 6, 2024

We released 0.27.0 with basic OpenAPI 3.1 support.

For further feature requests regarding 3.1 features, please open a new issue.

@tu-pm
Copy link

tu-pm commented Apr 17, 2024

Thanks @tfranzel for the hard work.

I'm playing around with the new OpenAPI 3.1 swagger from the latest release (drf-spectacular==0.27.2 and drf-spectacular-sidecar==2024.4.1) by setting 'OAS_VERSION': '3.1.0', in SPECTACULAR_SETTINGS and the Swagger UI page still displays this message:

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).

What am I missing here?

@tfranzel
Copy link
Owner

tfranzel commented Apr 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants