feat: (PoC) Support OpenAPI 3.1.x#1231
Conversation
CharlesDuboisSAP
left a comment
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
Shouldn’t it be version >= 3.1 ?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Is SodaCategory.name expected too be nullable? Soda.category was already nullable
There was a problem hiding this comment.
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.
…k-java into support-openapi-3.1
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.
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.