-
Notifications
You must be signed in to change notification settings - Fork 5
feat: upgrade to openapi-generator v7.0.0 #146
Conversation
354542f
to
660b7b4
Compare
e797863
to
0bf71ac
Compare
@@ -11,7 +11,7 @@ | |||
|**description** | **String** | | [optional] | | |||
|**facility** | [**Href**](Href.md) | | [optional] | | |||
|**id** | **UUID** | | [optional] | | |||
|**metro** | [**InterconnectionMetro**](InterconnectionMetro.md) | | [optional] | | |||
|**metro** | [**Metro**](Metro.md) | | [optional] | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the v7.0.0 features that is enabled by default is a schema simplification that recognizes that InterconnectionMetro
is really just a Metro
@@ -16,7 +16,6 @@ | |||
import java.util.Map; | |||
import java.util.List; | |||
|
|||
import javax.ws.rs.core.GenericType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of the generated changes are like this, removing an import javax.ws.rs.core.GenericType
that doesn't appear to have been used in most files anyway.
public static void validateJsonObject(JsonObject jsonObj) throws IOException { | ||
if (jsonObj == null) { | ||
if (!AttributeData.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null | ||
public static void validateJsonElement(JsonElement jsonElement) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is another repeated change here, validateJsonObject
changing to validateJsonElement
. Internally it seems to be non-impacting, but since it's a public method it's technically a breaking change; I'm not clear if this is something SDK consumers would/should use directly.
@@ -46,7 +45,7 @@ public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { | |||
* | |||
* @return an instance of the actual schema/object | |||
*/ | |||
public abstract Map<String, GenericType> getSchemas(); | |||
public abstract Map<String, Class<?>> getSchemas(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a place where import javax.ws.rs.core.GenericType
and it does require an additional code change, but even with this larger impact it's a small change.
import com.google.gson.TypeAdapter; | ||
import com.google.gson.annotations.JsonAdapter; | ||
import com.google.gson.annotations.SerializedName; | ||
import com.google.gson.stream.JsonReader; | ||
import com.google.gson.stream.JsonWriter; | ||
import java.io.IOException; | ||
import java.util.Arrays; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, moving this import is just unnecessary (and probably stylistically worse), but OK.
f864f7f
to
ab3bbd5
Compare
d1d0bb6
to
fcf30f1
Compare
This PR is included in version 0.8.0 🎉 |
The new version of openapi-generator includes a number of features that improve the quality of generated code and give more control over how the generator works with the given OpenAPI spec. For example, with v7.0.0+ we can tell the generator to generate inline enums as separate models; this is less compelling in Java--where inline enums can be defined as nested classes--than in Go, but it is nonetheless worth exploring, and there are additional options (inline schema naming , among others, that might help us make a better Java SDK.