Skip to content

feat: (PoC) Support OpenAPI 3.1.x#1231

Open
ZhongpinWang wants to merge 18 commits into
mainfrom
support-openapi-3.1
Open

feat: (PoC) Support OpenAPI 3.1.x#1231
ZhongpinWang wants to merge 18 commits into
mainfrom
support-openapi-3.1

Conversation

@ZhongpinWang

@ZhongpinWang ZhongpinWang commented Jul 21, 2026

Copy link
Copy Markdown

Context

This is a generated (later manually reviewed and fixed) PoC for evaluating the effort of supporting OpenAPI 3.1.x in the generator.

The following two files coming from the initial round of generation might be outdated but you can use as a reference.

  • Check the OAS31_GAPS.md for the gaps evaluated.
  • Check the OAS31_CHANGES.md for the actual changes generated.

I generated all data models in AI SDK Java with the new SNAPSHOT cloud sdk generator, and there were no breaking changes.

See SAP/ai-sdk-java#958 for the generated result.

@CharlesDuboisSAP CharlesDuboisSAP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some test coverage is lacking, you could add some more unit tests

{
return isOas31(rootNode.path("openapi").asText(null));
final String version = openAPI.getOpenapi();
return version != null && version.startsWith("3.1");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t it be version >= 3.1 ?

@ZhongpinWang ZhongpinWang Jul 23, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is hard to say >= 3.1 as they don't follow SemVer any more since 3.1. So there can be breaking changes in 3.2 and it should have an additional isOas32 to control the process logic.

So what is true in 3.1 may not be true in 3.2. As for now, I would suggest we just announce support for 3.1 and say 3.2 not supported.

* @param name The name of this {@link SodaCategory}
* @return The same instance of this {@link SodaCategory} class
*/
@Nonnull public SodaCategory name( @Nullable final String name) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is SodaCategory.name expected too be nullable? Soda.category was already nullable

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally prefer to make the property actually Nullable everywhere as it is a non-required property, which in Java can be represented as null. This behaviour aligns on the official openapi generator.

Also regenerating the AI SDK with this change introduced zero effort to add null check as these non-required properties were never called directly in our code.

And if there were never NPE before from the customers reported, then it means not many people ever used the Java SDK generator and get / set non-required properties. So it won't be breaking for them as well.

@ZhongpinWang
ZhongpinWang marked this pull request as ready for review July 23, 2026 13:42
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

Successfully merging this pull request may close these issues.

3 participants