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

[REQ] Support for OpenAPI Spec 3.1 #9083

Open
westn opened this issue Mar 25, 2021 · 57 comments
Open

[REQ] Support for OpenAPI Spec 3.1 #9083

westn opened this issue Mar 25, 2021 · 57 comments

Comments

@westn
Copy link

westn commented Mar 25, 2021

Is your feature request related to a problem? Please describe.

Support for OpenAPI Spec 3.1, released last month: https://github.com/OAI/OpenAPI-Specification/releases/tag/3.1.0

Describe the solution you'd like

Add support for OpenAPI Spec 3.1

Additional context

Couldn't see any other mention of this besides a short mention in #15
Another note on https://www.openapis.org/blog/2020/06/18/openapi-3-1-0-rc0-its-here which mention that the specification-change is bigger than it sounds and might break some tooling.

@spacether
Copy link
Contributor

We use swagger-parser to parse openapi specs. That project must implement v 3.1 spec parsing before we can implement it in the generators.

@darkbasic
Copy link

https://github.com/swagger-api/swagger-parser/commits/oas3.1

@cgfarmer4
Copy link
Contributor

Any updates to share on potentially updating the generators to OAS 3.1?

@gunsluo
Copy link

gunsluo commented May 15, 2022

Any updates to share on potentially updating the generators to OAS 3.1?

swagger-api/swagger-parser#1535, there has been no update for half a year.

@cyangle
Copy link
Contributor

cyangle commented May 27, 2022

OAS 3.1 support has been added to swagger-parser in swagger-api/swagger-parser#1730

@denisgolubovic
Copy link

What release do you aim for this to be implemented in the generator? 6.1.0?

@kiwisincebirth
Copy link

swagger-parser 2.1 has been released with OAS 3.1 support
https://github.com/swagger-api/swagger-parser/releases/tag/v2.1.0

@RickKukiela
Copy link

This is a big oof on my part. I just spent a ton of time setting up an API spec for a client and used 3.1.0 and now that its all approved I need to actually program the API server and need to generate the base files from the spec. Now I find out that not only does this package not support 3.1.0 currently but I cannot seem to find any code generator that does :( big yikes! I have to figure out what my options are at this point as my spec currently makes heavy use of the type as an array not a string and I also use oneOf with "null" or a $ref throughout the whole thing which makes it a major problem to downgrade to 3.0.3 at this point.

I see that as of 27 days ago at the time of me writing this, the 3.1 spec was added to swagger-api/swagger-parser#1535 - Does anyone have any idea when there will be a beta / snapshot release that will support 3.1.0 as if its going to be soon(tm), I might keep just waiting for that as an option before nuking my 3.1.0 setup....

@slPerryRhodan
Copy link

slPerryRhodan commented Jun 23, 2022

We are also waiting for this feature, to generate classes from components if there is no API (e. g. publish Kafka Event Objects as Open Api Spec). I hope there will be soon a new release for that.

@tobq
Copy link

tobq commented Jul 6, 2022

Any updates on 3.1 support?

@Stokestack
Copy link

This is a huge impediment. I too have an API that relies on 3.1 features. It seems to be taking the toolchain a very long time to support it.

@spacether
Copy link
Contributor

This is a big oof on my part. I just spent a ton of time setting up an API spec for a client and used 3.1.0 and now that its all approved I need to actually program the API server and need to generate the base files from the spec. Now I find out that not only does this package not support 3.1.0 currently but I cannot seem to find any code generator that does :( big yikes! I have to figure out what my options are at this point as my spec currently makes heavy use of the type as an array not a string and I also use oneOf with "null" or a $ref throughout the whole thing which makes it a major problem to downgrade to 3.0.3 at this point.

I see that as of 27 days ago at the time of me writing this, the 3.1 spec was added to swagger-api/swagger-parser#1535 - Does anyone have any idea when there will be a beta / snapshot release that will support 3.1.0 as if its going to be soon(tm), I might keep just waiting for that as an option before nuking my 3.1.0 setup....

Type null works with 3.0.3 specs and our tool
Type arrays can be converted to oneOf with each type in a different schema.

@philsturgeon
Copy link
Contributor

Hello! As the maintainer of openapi.tools, and as somebody works with Linux Foundation helping out in OpenAPI-land, I'm reaching out to tooling vendors to track the progress towards supporting OpenAPI v3.1, to see what roadblocks there are beyond folks just generally being busy at this ridiculous time.

OpenAPI v3.1 has a bunch of great little changes, solving problems like the JSON Schema <!=> OpenAPI Schema Object divergence. It also fixes some other inconsistencies and duplicate ways of doing things. It's the best version and everyone should be using it, but we need tooling to catch up. Just in case folks didn't notice, or don't have resources to simplify the process, I'm here to give a friendly prod and send over some handy links.

Here are a few articles showing off the differences between OpenAPI v3.0 and v3.1.

Here are some example files which can make for handy pass/fail test cases:

https://github.com/Mermade/openapi3-examples/tree/master/3.1

If you're looking for the JSON Schema that defines a valid OpenAPI document, that'll be right over here:

https://github.com/OAI/OpenAPI-Specification/tree/main/schemas/v3.1

No rush, but when you're starting work on it, please update this issue so I can update openapi.tools to reflect that, and folks will have a way to subscribe for updates.

LMK if you have any questions!

@marcelstoer
Copy link
Contributor

Apart from the actual lack of 3.1 support the biggest issue I have is that this project does not seem to be open about it.

The README doesn't mention it. https://openapi-generator.tech/ prominently claims

from OpenAPI 2.0/3.x documents

which led me to believe that 3.1 be fully supported.

@RickKukiela
Copy link

Probably should say 3.0.x...

@karenetheridge
Copy link

It would be helpful to see an itemized list of what is still needed to achieve v3.1 support, so that members of the community can help out. Has anyone identified those tasks?

@spacether
Copy link
Contributor

spacether commented Aug 3, 2022

It would be helpful to see an itemized list of what is still needed to achieve v3.1 support, so that members of the community can help out. Has anyone identified those tasks?

I am putting together that list now and we will publish a project very soon. This is something that we all want to add to openapi-generator. It is ~30 feature additions to store the new openapi/json schema data in our java classes. Then that data needs to be used by the generators to generate code that imposes the new json schema validation + adds new openapi features.

@spacether
Copy link
Contributor

spacether commented Aug 4, 2022

We have a project to track adding 3.1.0 support here:
https://github.com/orgs/OpenAPITools/projects/4/views/1 and welcome any PRs adding these features

Generators that will have 3.1.0 support prioritized:
#13073

Tag for 3.1.0 issues/PRs:
https://github.com/OpenAPITools/openapi-generator/issues?q=is%3Aissue+is%3Aopen+label%3A%22Feature%3A+OAS+3.1.0+spec+support%22

@spacether
Copy link
Contributor

spacether commented Sep 27, 2023

Hello! As the maintainer of openapi.tools, and as somebody works with Linux Foundation helping out in OpenAPI-land, I'm reaching out to tooling vendors to track the progress towards supporting OpenAPI v3.1, to see what roadblocks there are beyond folks just generally being busy at this ridiculous time.

...
LMK if you have any questions!

@philsturgeon one big roadblock is that there are a number of bugs in swagger-parser that prevent json schema test cases from running/passing. One can see 10 of those bugs here: https://github.com/swagger-api/swagger-parser/issues?q=is%3Aissue+is%3Aopen+3.1.0+author%3Aspacether
If people want these features to work, please consider helping fix these bugs in swagger-parser.
The one breaking the most test cases is: swagger-api/swagger-parser#1770

@philsturgeon
Copy link
Contributor

philsturgeon commented Sep 28, 2023

@spacether I'm sorry to say I've got absolutely nothing to do with https://github.com/swagger-api/swagger-parser.

You're mistaking it for https://github.com/APIDevTools/swagger-parser, which I do occasionally maintain, but it's is a whole other thing.

@spacether
Copy link
Contributor

spacether commented Sep 28, 2023

Just answering your what are the roadblocks question, not saying that you are associated with swagger-parser.

@spacether
Copy link
Contributor

spacether commented Sep 29, 2023

OpenAPI v3.1.0 python code generation is now supported in openapi-json-schema-generator

Heads up, I just released v3.3.0 of openapi-json-schema-generator which allows python code generation using an openapi v3.1.0 document.

Over 66% of the 3.1.0 new json schema keyword features have been implemented
3.1.0 spec support includes these added/updated json schema keywords:

  1. type (array of types supported in addition to one non-array value)
  2. const: only string values are working because of bugs in swagger parser
  3. contains
  4. dependentRequired
  5. dependentSchemas
  6. maxContains
  7. minContains
  8. patternProperties
  9. prefixItems
  10. propertyNames
  11. unevaluatedItems
  12. unevaluatedProperties
  13. if
  14. then
  15. else

@spacether
Copy link
Contributor

spacether commented Jan 5, 2024

@adampoplawski @phillipuniverse I have been working on a Java generator and v3.0.0-v3.0.3 openapi schema validation has been implemented in java. This includes List/Map output classes, List/Map builder classes, and Enums which are accepted into Schema.validate and the List/Map builders. Read all about it here. The Java schema validation is available in my v4.0.0 release.

@sheldonreddy
Copy link

Hi,

When can we expect the openapi specification version 3.1.0 to be supported by the OpenAPI-Generator tooling? Is there any roadmap we can reference to keep an eye on?

Thanks

@wing328
Copy link
Member

wing328 commented Jan 10, 2024

latest stable version v7.2.0 comes with beta support. you can give it a try to see if it works for your use cases.

@sheldonreddy
Copy link

Thanks @wing328 - will give it a shot.

@spacether
Copy link
Contributor

spacether commented Jan 17, 2024

@wing328

  • Where was the beta support added?
  • What 3.1.0 features were added in what generators?

The only 3.1.0 PR that I see in that release is #17174 looking at the release notes and doing a search for 3.1.0

@spacether
Copy link
Contributor

spacether commented Jan 22, 2024

openapi v3.1.0 schema support added for java in openapi-json-schema-generator

Heads up, I just released v4.1.0 of openapi-json-schema-generator which allows java code generation using an openapi v3.1.0 document.

Over 67% of the 3.1.0 new json schema keyword features have been implemented
3.1.0 spec support includes these added/updated json schema keywords, which are tested with the json schema test suite in CI:

  1. type (array of types supported in addition to one non-array value)
  2. const: only string values are working because of bugs in swagger parser
  3. contains
  4. dependentRequired
  5. dependentSchemas
  6. maxContains
  7. minContains
  8. patternProperties
  9. prefixItems
  10. propertyNames
  11. unevaluatedItems
  12. unevaluatedProperties
  13. if
  14. then
  15. else

@adampoplawski
Copy link

@wing328 Can you share the status of 3.1.0 support?

@wing328
Copy link
Member

wing328 commented Mar 20, 2024

The best way to get updates regarding OpenAPI 3.1 support (beta) is via the Label in the pull request tab: https://github.com/OpenAPITools/openapi-generator/pulls?q=+is%3Apr+label%3A%22Feature%3A+OAS+3.1.0+spec+support%22+

@spacether
Copy link
Contributor

spacether commented Apr 12, 2024

openapi 3.1.0 support added for the java generator in openapi-json-schema-generator

Heads up, I just released v4.2.1 which includes the stable java sdk generator

  • It includes thorough endpoint code samples for schema validation an endpoint invocation
  • Sealed classes are used for validated schema payloads/request bodies/responses/response bodies
  • Code is re-used rather than generated multiple times: If an endpoint has multiple tags, the endpoint method is defined once as a default method in an interface, and that interface is implemented in each tag's api class

@jahlbornG
Copy link

@wing328 you mentioned that beta 3.1.0 support is available, but i can't see any information about enabling this support? can you please provide more details?

@david0
Copy link

david0 commented Jul 9, 2024

As complete OpenAPI 3.1 support doesn't seem to come soon, I would like to understand what the current state is.

Wouldn't it make sense to document somewhere what experimental means and which features should working correctly?

@wing328
Copy link
Member

wing328 commented Jul 9, 2024

@jahlbornG it's automatic. if your spec is documented as 3.1.0, it will enable the beta support. v7.7.0 was released last week. please give it a try as it includes more fixes for v3.1.0 spec

@david0
Copy link

david0 commented Jul 9, 2024

The enabling is not the question, my question is what to expect? What does beta mean? Should I expect all features to be there and just not as solid as 3.0?

@jahlbornG
Copy link

jahlbornG commented Jul 11, 2024

@jahlbornG it's automatic. if your spec is documented as 3.1.0, it will enable the beta support. v7.7.0 was released last week. please give it a try as it includes more fixes for v3.1.0 spec

@wing328 i am using the generator maven plugin to convert a swagger (2.0) document to an openapi spec document. it seems to generate 3.0.1 by default, and i'd love to get it to generate 3.1.0.

@dankgen-tobias
Copy link

Is there a roadmap for the full support for 3.1? There is a project https://github.com/orgs/OpenAPITools/projects/4/views/1 that tackles this but there haven't been any changes since january

@trohovsky-mhp
Copy link

trohovsky-mhp commented Jul 24, 2024

It would be great if openapi-generator tackled the issue that properties in model classes are generated with Object type instead of String, Integer, etc. #15203

@Haarolean
Copy link

@wing328 what's the process of reporting issues encountered while building 3.1 specs? Should I raise a separate issue or sth else?

@wing328
Copy link
Member

wing328 commented Aug 21, 2024

Should I raise a separate issue

yes please

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

No branches or pull requests