@@ -108,7 +113,7 @@
- ${project.basedir}/src/main/resources/sodastore.json
+ ${project.basedir}/src/main/resources/sodastore.yaml
com.sap.cloud.sdk.datamodel.openapi.sample.api
com.sap.cloud.sdk.datamodel.openapi.sample.model
released
@@ -119,6 +124,7 @@
create
protected
+ true
true
diff --git a/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/api/SodasApi.java b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/api/SodasApi.java
index adbe72a0e..ebf06d60d 100644
--- a/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/api/SodasApi.java
+++ b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/api/SodasApi.java
@@ -178,9 +178,9 @@ public SodaWithId sodasIdGet( @Nonnull final Long id )
*
* 200 - The updated soda product
*
- * 404 - Soda product not found
- *
* 204 - Nothing has changed
+ *
+ * 404 - Soda product not found
*
* @param sodaWithId
* The updated soda product
diff --git a/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/AllOf.java b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/AllOf.java
new file mode 100644
index 000000000..67884d8a2
--- /dev/null
+++ b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/AllOf.java
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * SodaStore API
+ * API for managing soda products and orders in SodaStore.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.sap.cloud.sdk.datamodel.openapi.sample.model;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.Set;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * AllOf
+ */
+// CHECKSTYLE:OFF
+public class AllOf
+// CHECKSTYLE:ON
+{
+ @JsonProperty( "sodaType" )
+ private String sodaType;
+
+ @JsonProperty( "caffeine" )
+ private Boolean caffeine;
+
+ @JsonProperty( "color" )
+ private String color;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Default constructor for AllOf.
+ */
+ protected AllOf()
+ {
+ }
+
+ /**
+ * Set the sodaType of this {@link AllOf} instance and return the same instance.
+ *
+ * @param sodaType
+ * The sodaType of this {@link AllOf}
+ * @return The same instance of this {@link AllOf} class
+ */
+ @Nonnull
+ public AllOf sodaType( @Nullable final String sodaType )
+ {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ *
+ * @return sodaType The sodaType of this {@link AllOf} instance.
+ */
+ @Nonnull
+ public String getSodaType()
+ {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link AllOf} instance.
+ *
+ * @param sodaType
+ * The sodaType of this {@link AllOf}
+ */
+ public void setSodaType( @Nullable final String sodaType )
+ {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Set the caffeine of this {@link AllOf} instance and return the same instance.
+ *
+ * @param caffeine
+ * The caffeine of this {@link AllOf}
+ * @return The same instance of this {@link AllOf} class
+ */
+ @Nonnull
+ public AllOf caffeine( @Nullable final Boolean caffeine )
+ {
+ this.caffeine = caffeine;
+ return this;
+ }
+
+ /**
+ * Get caffeine
+ *
+ * @return caffeine The caffeine of this {@link AllOf} instance.
+ */
+ @Nonnull
+ public Boolean isCaffeine()
+ {
+ return caffeine;
+ }
+
+ /**
+ * Set the caffeine of this {@link AllOf} instance.
+ *
+ * @param caffeine
+ * The caffeine of this {@link AllOf}
+ */
+ public void setCaffeine( @Nullable final Boolean caffeine )
+ {
+ this.caffeine = caffeine;
+ }
+
+ /**
+ * Set the color of this {@link AllOf} instance and return the same instance.
+ *
+ * @param color
+ * The color of this {@link AllOf}
+ * @return The same instance of this {@link AllOf} class
+ */
+ @Nonnull
+ public AllOf color( @Nullable final String color )
+ {
+ this.color = color;
+ return this;
+ }
+
+ /**
+ * Get color
+ *
+ * @return color The color of this {@link AllOf} instance.
+ */
+ @Nonnull
+ public String getColor()
+ {
+ return color;
+ }
+
+ /**
+ * Set the color of this {@link AllOf} instance.
+ *
+ * @param color
+ * The color of this {@link AllOf}
+ */
+ public void setColor( @Nullable final String color )
+ {
+ this.color = color;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link AllOf}.
+ *
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames()
+ {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link AllOf} instance.
+ *
+ * @param name
+ * The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException
+ * If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name )
+ throws NoSuchElementException
+ {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("AllOf has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link AllOf} instance. If the map previously contained a mapping for the
+ * key, the old value is replaced by the specified value.
+ *
+ * @param customFieldName
+ * The name of the property
+ * @param customFieldValue
+ * The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+ @Override
+ public boolean equals( @Nullable final java.lang.Object o )
+ {
+ if( this == o ) {
+ return true;
+ }
+ if( o == null || getClass() != o.getClass() ) {
+ return false;
+ }
+ final AllOf allOf = (AllOf) o;
+ return Objects.equals(this.cloudSdkCustomFields, allOf.cloudSdkCustomFields)
+ && Objects.equals(this.sodaType, allOf.sodaType)
+ && Objects.equals(this.caffeine, allOf.caffeine)
+ && Objects.equals(this.color, allOf.color);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return Objects.hash(sodaType, caffeine, color, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull
+ public String toString()
+ {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AllOf {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ sb.append(" caffeine: ").append(toIndentedString(caffeine)).append("\n");
+ sb.append(" color: ").append(toIndentedString(color)).append("\n");
+ cloudSdkCustomFields
+ .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString( final java.lang.Object o )
+ {
+ if( o == null ) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+ /**
+ * Create a new {@link AllOf} instance. No arguments are required.
+ */
+ public static AllOf create()
+ {
+ return new AllOf();
+ }
+
+}
diff --git a/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/AnyOf.java b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/AnyOf.java
new file mode 100644
index 000000000..5c40e1e68
--- /dev/null
+++ b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/AnyOf.java
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * SodaStore API
+ * API for managing soda products and orders in SodaStore.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.sap.cloud.sdk.datamodel.openapi.sample.model;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.Set;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * AnyOf
+ */
+// CHECKSTYLE:OFF
+public class AnyOf
+// CHECKSTYLE:ON
+{
+ @JsonProperty( "sodaType" )
+ private String sodaType;
+
+ @JsonProperty( "caffeine" )
+ private Boolean caffeine;
+
+ @JsonProperty( "color" )
+ private String color;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Default constructor for AnyOf.
+ */
+ protected AnyOf()
+ {
+ }
+
+ /**
+ * Set the sodaType of this {@link AnyOf} instance and return the same instance.
+ *
+ * @param sodaType
+ * The sodaType of this {@link AnyOf}
+ * @return The same instance of this {@link AnyOf} class
+ */
+ @Nonnull
+ public AnyOf sodaType( @Nullable final String sodaType )
+ {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ *
+ * @return sodaType The sodaType of this {@link AnyOf} instance.
+ */
+ @Nonnull
+ public String getSodaType()
+ {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link AnyOf} instance.
+ *
+ * @param sodaType
+ * The sodaType of this {@link AnyOf}
+ */
+ public void setSodaType( @Nullable final String sodaType )
+ {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Set the caffeine of this {@link AnyOf} instance and return the same instance.
+ *
+ * @param caffeine
+ * The caffeine of this {@link AnyOf}
+ * @return The same instance of this {@link AnyOf} class
+ */
+ @Nonnull
+ public AnyOf caffeine( @Nullable final Boolean caffeine )
+ {
+ this.caffeine = caffeine;
+ return this;
+ }
+
+ /**
+ * Get caffeine
+ *
+ * @return caffeine The caffeine of this {@link AnyOf} instance.
+ */
+ @Nonnull
+ public Boolean isCaffeine()
+ {
+ return caffeine;
+ }
+
+ /**
+ * Set the caffeine of this {@link AnyOf} instance.
+ *
+ * @param caffeine
+ * The caffeine of this {@link AnyOf}
+ */
+ public void setCaffeine( @Nullable final Boolean caffeine )
+ {
+ this.caffeine = caffeine;
+ }
+
+ /**
+ * Set the color of this {@link AnyOf} instance and return the same instance.
+ *
+ * @param color
+ * The color of this {@link AnyOf}
+ * @return The same instance of this {@link AnyOf} class
+ */
+ @Nonnull
+ public AnyOf color( @Nullable final String color )
+ {
+ this.color = color;
+ return this;
+ }
+
+ /**
+ * Get color
+ *
+ * @return color The color of this {@link AnyOf} instance.
+ */
+ @Nonnull
+ public String getColor()
+ {
+ return color;
+ }
+
+ /**
+ * Set the color of this {@link AnyOf} instance.
+ *
+ * @param color
+ * The color of this {@link AnyOf}
+ */
+ public void setColor( @Nullable final String color )
+ {
+ this.color = color;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link AnyOf}.
+ *
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames()
+ {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link AnyOf} instance.
+ *
+ * @param name
+ * The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException
+ * If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name )
+ throws NoSuchElementException
+ {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("AnyOf has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link AnyOf} instance. If the map previously contained a mapping for the
+ * key, the old value is replaced by the specified value.
+ *
+ * @param customFieldName
+ * The name of the property
+ * @param customFieldValue
+ * The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+ @Override
+ public boolean equals( @Nullable final java.lang.Object o )
+ {
+ if( this == o ) {
+ return true;
+ }
+ if( o == null || getClass() != o.getClass() ) {
+ return false;
+ }
+ final AnyOf anyOf = (AnyOf) o;
+ return Objects.equals(this.cloudSdkCustomFields, anyOf.cloudSdkCustomFields)
+ && Objects.equals(this.sodaType, anyOf.sodaType)
+ && Objects.equals(this.caffeine, anyOf.caffeine)
+ && Objects.equals(this.color, anyOf.color);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return Objects.hash(sodaType, caffeine, color, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull
+ public String toString()
+ {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AnyOf {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ sb.append(" caffeine: ").append(toIndentedString(caffeine)).append("\n");
+ sb.append(" color: ").append(toIndentedString(color)).append("\n");
+ cloudSdkCustomFields
+ .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString( final java.lang.Object o )
+ {
+ if( o == null ) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+ /**
+ * Create a new {@link AnyOf} instance. No arguments are required.
+ */
+ public static AnyOf create()
+ {
+ return new AnyOf();
+ }
+
+}
diff --git a/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/Cola.java b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/Cola.java
new file mode 100644
index 000000000..80cab38dd
--- /dev/null
+++ b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/Cola.java
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * SodaStore API
+ * API for managing soda products and orders in SodaStore.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.sap.cloud.sdk.datamodel.openapi.sample.model;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.Set;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Cola
+ */
+// CHECKSTYLE:OFF
+public class Cola implements OneOf, OneOfWithDiscriminator, OneOfWithDiscriminatorAndMapping
+// CHECKSTYLE:ON
+{
+ @JsonProperty( "sodaType" )
+ private String sodaType;
+
+ @JsonProperty( "caffeine" )
+ private Boolean caffeine;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Default constructor for Cola.
+ */
+ protected Cola()
+ {
+ }
+
+ /**
+ * Set the sodaType of this {@link Cola} instance and return the same instance.
+ *
+ * @param sodaType
+ * The sodaType of this {@link Cola}
+ * @return The same instance of this {@link Cola} class
+ */
+ @Nonnull
+ public Cola sodaType( @Nullable final String sodaType )
+ {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ *
+ * @return sodaType The sodaType of this {@link Cola} instance.
+ */
+ @Nonnull
+ public String getSodaType()
+ {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link Cola} instance.
+ *
+ * @param sodaType
+ * The sodaType of this {@link Cola}
+ */
+ public void setSodaType( @Nullable final String sodaType )
+ {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Set the caffeine of this {@link Cola} instance and return the same instance.
+ *
+ * @param caffeine
+ * The caffeine of this {@link Cola}
+ * @return The same instance of this {@link Cola} class
+ */
+ @Nonnull
+ public Cola caffeine( @Nullable final Boolean caffeine )
+ {
+ this.caffeine = caffeine;
+ return this;
+ }
+
+ /**
+ * Get caffeine
+ *
+ * @return caffeine The caffeine of this {@link Cola} instance.
+ */
+ @Nonnull
+ public Boolean isCaffeine()
+ {
+ return caffeine;
+ }
+
+ /**
+ * Set the caffeine of this {@link Cola} instance.
+ *
+ * @param caffeine
+ * The caffeine of this {@link Cola}
+ */
+ public void setCaffeine( @Nullable final Boolean caffeine )
+ {
+ this.caffeine = caffeine;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link Cola}.
+ *
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames()
+ {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link Cola} instance.
+ *
+ * @param name
+ * The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException
+ * If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name )
+ throws NoSuchElementException
+ {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("Cola has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link Cola} instance. If the map previously contained a mapping for the
+ * key, the old value is replaced by the specified value.
+ *
+ * @param customFieldName
+ * The name of the property
+ * @param customFieldValue
+ * The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+ @Override
+ public boolean equals( @Nullable final java.lang.Object o )
+ {
+ if( this == o ) {
+ return true;
+ }
+ if( o == null || getClass() != o.getClass() ) {
+ return false;
+ }
+ final Cola cola = (Cola) o;
+ return Objects.equals(this.cloudSdkCustomFields, cola.cloudSdkCustomFields)
+ && Objects.equals(this.sodaType, cola.sodaType)
+ && Objects.equals(this.caffeine, cola.caffeine);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return Objects.hash(sodaType, caffeine, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull
+ public String toString()
+ {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class Cola {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ sb.append(" caffeine: ").append(toIndentedString(caffeine)).append("\n");
+ cloudSdkCustomFields
+ .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString( final java.lang.Object o )
+ {
+ if( o == null ) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+ /**
+ * Create a new {@link Cola} instance. No arguments are required.
+ */
+ public static Cola create()
+ {
+ return new Cola();
+ }
+
+}
diff --git a/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/Fanta.java b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/Fanta.java
new file mode 100644
index 000000000..5a14ed75b
--- /dev/null
+++ b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/Fanta.java
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * SodaStore API
+ * API for managing soda products and orders in SodaStore.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.sap.cloud.sdk.datamodel.openapi.sample.model;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.Set;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Fanta
+ */
+// CHECKSTYLE:OFF
+public class Fanta implements OneOf, OneOfWithDiscriminator, OneOfWithDiscriminatorAndMapping
+// CHECKSTYLE:ON
+{
+ @JsonProperty( "sodaType" )
+ private String sodaType;
+
+ @JsonProperty( "color" )
+ private String color;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Default constructor for Fanta.
+ */
+ protected Fanta()
+ {
+ }
+
+ /**
+ * Set the sodaType of this {@link Fanta} instance and return the same instance.
+ *
+ * @param sodaType
+ * The sodaType of this {@link Fanta}
+ * @return The same instance of this {@link Fanta} class
+ */
+ @Nonnull
+ public Fanta sodaType( @Nullable final String sodaType )
+ {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ *
+ * @return sodaType The sodaType of this {@link Fanta} instance.
+ */
+ @Nonnull
+ public String getSodaType()
+ {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link Fanta} instance.
+ *
+ * @param sodaType
+ * The sodaType of this {@link Fanta}
+ */
+ public void setSodaType( @Nullable final String sodaType )
+ {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Set the color of this {@link Fanta} instance and return the same instance.
+ *
+ * @param color
+ * The color of this {@link Fanta}
+ * @return The same instance of this {@link Fanta} class
+ */
+ @Nonnull
+ public Fanta color( @Nullable final String color )
+ {
+ this.color = color;
+ return this;
+ }
+
+ /**
+ * Get color
+ *
+ * @return color The color of this {@link Fanta} instance.
+ */
+ @Nonnull
+ public String getColor()
+ {
+ return color;
+ }
+
+ /**
+ * Set the color of this {@link Fanta} instance.
+ *
+ * @param color
+ * The color of this {@link Fanta}
+ */
+ public void setColor( @Nullable final String color )
+ {
+ this.color = color;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link Fanta}.
+ *
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames()
+ {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link Fanta} instance.
+ *
+ * @param name
+ * The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException
+ * If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name )
+ throws NoSuchElementException
+ {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("Fanta has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link Fanta} instance. If the map previously contained a mapping for the
+ * key, the old value is replaced by the specified value.
+ *
+ * @param customFieldName
+ * The name of the property
+ * @param customFieldValue
+ * The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+ @Override
+ public boolean equals( @Nullable final java.lang.Object o )
+ {
+ if( this == o ) {
+ return true;
+ }
+ if( o == null || getClass() != o.getClass() ) {
+ return false;
+ }
+ final Fanta fanta = (Fanta) o;
+ return Objects.equals(this.cloudSdkCustomFields, fanta.cloudSdkCustomFields)
+ && Objects.equals(this.sodaType, fanta.sodaType)
+ && Objects.equals(this.color, fanta.color);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return Objects.hash(sodaType, color, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull
+ public String toString()
+ {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class Fanta {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ sb.append(" color: ").append(toIndentedString(color)).append("\n");
+ cloudSdkCustomFields
+ .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString( final java.lang.Object o )
+ {
+ if( o == null ) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+ /**
+ * Create a new {@link Fanta} instance. No arguments are required.
+ */
+ public static Fanta create()
+ {
+ return new Fanta();
+ }
+
+}
diff --git a/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/OneOf.java b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/OneOf.java
new file mode 100644
index 000000000..6531d1c5c
--- /dev/null
+++ b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/OneOf.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * SodaStore API
+ * API for managing soda products and orders in SodaStore.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.sap.cloud.sdk.datamodel.openapi.sample.model;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+
+/**
+ * OneOf
+ */
+
+@JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "", visible = true )
+
+public interface OneOf
+{
+}
diff --git a/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/OneOfWithDiscriminator.java b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/OneOfWithDiscriminator.java
new file mode 100644
index 000000000..10921d603
--- /dev/null
+++ b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/OneOfWithDiscriminator.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * SodaStore API
+ * API for managing soda products and orders in SodaStore.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.sap.cloud.sdk.datamodel.openapi.sample.model;
+
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+
+/**
+ * OneOfWithDiscriminator
+ */
+
+@JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "sodaType", visible = true )
+@JsonSubTypes( {
+ @JsonSubTypes.Type( value = Cola.class, name = "Cola" ),
+ @JsonSubTypes.Type( value = Fanta.class, name = "Fanta" ), } )
+
+public interface OneOfWithDiscriminator
+{
+ public String getSodaType();
+}
diff --git a/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/OneOfWithDiscriminatorAndMapping.java b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/OneOfWithDiscriminatorAndMapping.java
new file mode 100644
index 000000000..f1014bd8a
--- /dev/null
+++ b/datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/OneOfWithDiscriminatorAndMapping.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * SodaStore API
+ * API for managing soda products and orders in SodaStore.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.sap.cloud.sdk.datamodel.openapi.sample.model;
+
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+
+/**
+ * OneOfWithDiscriminatorAndMapping
+ */
+
+@JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "sodaType", visible = true )
+@JsonSubTypes( {
+ @JsonSubTypes.Type( value = Cola.class, name = "Cola" ),
+ @JsonSubTypes.Type( value = Fanta.class, name = "Fanta" ), } )
+
+public interface OneOfWithDiscriminatorAndMapping
+{
+ public String getSodaType();
+}
diff --git a/datamodel/openapi/openapi-api-sample/src/main/resources/sodastore.json b/datamodel/openapi/openapi-api-sample/src/main/resources/sodastore.json
deleted file mode 100644
index 2f2bd0412..000000000
--- a/datamodel/openapi/openapi-api-sample/src/main/resources/sodastore.json
+++ /dev/null
@@ -1,290 +0,0 @@
-{
- "openapi": "3.0.3",
- "info": {
- "title": "SodaStore API",
- "version": "1.0.0",
- "description": "API for managing soda products and orders in SodaStore."
- },
- "tags": [
- {
- "name": "Sodas",
- "description": "Everything about our Sodas"
- },
- {
- "name": "user",
- "description": "Operations about user"
- },
- {
- "name": "Orders",
- "description": "Access to Sodastore orders"
- }
- ],
- "components": {
- "securitySchemes": {
- "apiKeyAuth": {
- "type": "apiKey",
- "in": "header",
- "name": "X-API-Key"
- },
- "bearerAuth": {
- "type": "http",
- "scheme": "bearer"
- }
- },
- "schemas": {
- "Soda": {
- "type": "object",
- "required": [
- "name",
- "brand",
- "quantity",
- "price"
- ],
- "properties": {
- "name": {
- "type": "string",
- "example": "Cola"
- },
- "brand": {
- "type": "string",
- "example": "Coca-Cola"
- },
- "quantity": {
- "type": "integer",
- "format": "int32",
- "example": 100
- },
- "packaging": {
- "type": "string",
- "enum": ["glass", "carton", "can"],
- "nullable": false
- },
- "price": {
- "type": "number",
- "format": "float",
- "example": 1.5
- }
- }
- },
- "SodaWithId": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Soda"
- },
- {
- "type": "object",
- "properties": {
- "id": {
- "type": "integer",
- "format": "int64",
- "example": 123
- }
- }
- }
- ]
- },
- "Order": {
- "type": "object",
- "required": [
- "productId",
- "quantity"
- ],
- "properties": {
- "productId": {
- "type": "integer",
- "format": "int64",
- "example": 1
- },
- "quantity": {
- "type": "integer",
- "format": "int32",
- "example": 2
- },
- "totalPrice": {
- "type": "number",
- "format": "float",
- "example": 3.0
- },
- "typelessProperty": {
- "description": "Some typeless property, interpreted by the generator as nullable by default (because typeless)"
- },
- "nullableProperty": {
- "type": "string",
- "description": "Some typed property that is deliberately made nullable",
- "nullable": true
- }
- }
- },
- "OrderWithTimestamp": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Order"
- },
- {
- "type": "object",
- "properties": {
- "timestamp": {
- "type": "string",
- "format": "date-time"
- }
- }
- }
- ]
- }
- }
- },
- "paths": {
- "/sodas": {
- "get": {
- "summary": "Get all soda products",
- "tags": [
- "Sodas"
- ],
- "security": [
- {
- "apiKeyAuth": [ ]
- }
- ],
- "responses": {
- "200": {
- "description": "A list of soda products",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/SodaWithId"
- }
- }
- }
- }
- }
- }
- },
- "put": {
- "summary": "Update a specific soda product by ID",
- "tags": [
- "Sodas"
- ],
- "security": [
- {
- "apiKeyAuth": [ ]
- }
- ],
- "requestBody": {
- "description": "The updated soda product",
- "required": true,
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/SodaWithId"
- }
- }
- }
- },
- "responses": {
- "200": {
- "description": "The updated soda product",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Soda"
- }
- }
- }
- },
- "404": {
- "description": "Soda product not found"
- },
- "204": {
- "description": "Nothing has changed"
- }
- }
- }
- },
- "/sodas/{id}": {
- "get": {
- "summary": "Get a specific soda product by ID",
- "tags": [
- "Sodas"
- ],
- "security": [
- {
- "apiKeyAuth": [ ]
- }
- ],
- "parameters": [
- {
- "name": "id",
- "in": "path",
- "description": "ID of the soda product to retrieve",
- "required": true,
- "schema": {
- "type": "integer",
- "format": "int64"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "The soda product",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/SodaWithId"
- }
- }
- }
- },
- "404": {
- "description": "Soda product not found"
- }
- }
- }
- },
- "/orders": {
- "post": {
- "summary": "Create a new order",
- "tags": [
- "Orders"
- ],
- "security": [
- {
- "apiKeyAuth": [ ]
- }
- ],
- "requestBody": {
- "description": "The order details",
- "required": true,
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Order"
- }
- }
- }
- },
- "responses": {
- "201": {
- "description": "The created order",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Order"
- }
- }
- }
- }
- }
- }
- }
- },
- "security": [
- {
- "apiKeyAuth": [ ]
- },
- {
- "bearerAuth": [ ]
- }
- ]
-}
diff --git a/datamodel/openapi/openapi-api-sample/src/main/resources/sodastore.yaml b/datamodel/openapi/openapi-api-sample/src/main/resources/sodastore.yaml
new file mode 100644
index 000000000..615141845
--- /dev/null
+++ b/datamodel/openapi/openapi-api-sample/src/main/resources/sodastore.yaml
@@ -0,0 +1,224 @@
+openapi: 3.0.3
+info:
+ title: SodaStore API
+ version: 1.0.0
+ description: API for managing soda products and orders in SodaStore.
+tags:
+ - name: Sodas
+ description: Everything about our Sodas
+ - name: user
+ description: Operations about user
+ - name: Orders
+ description: Access to Sodastore orders
+components:
+ securitySchemes:
+ apiKeyAuth:
+ type: apiKey
+ in: header
+ name: X-API-Key
+ bearerAuth:
+ type: http
+ scheme: bearer
+ schemas:
+ Soda:
+ type: object
+ required:
+ - name
+ - brand
+ - quantity
+ - price
+ properties:
+ name:
+ type: string
+ example: Cola
+ brand:
+ type: string
+ example: Coca-Cola
+ quantity:
+ type: integer
+ format: int32
+ example: 100
+ packaging:
+ type: string
+ enum:
+ - glass
+ - carton
+ - can
+ nullable: false
+ price:
+ type: number
+ format: float
+ example: 1.5
+ SodaWithId:
+ allOf:
+ - $ref: '#/components/schemas/Soda'
+ - type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ example: 123
+ Order:
+ type: object
+ required:
+ - productId
+ - quantity
+ properties:
+ productId:
+ type: integer
+ format: int64
+ example: 1
+ quantity:
+ type: integer
+ format: int32
+ example: 2
+ totalPrice:
+ type: number
+ format: float
+ example: 3
+ typelessProperty:
+ description: >-
+ Some typeless property, interpreted by the generator as nullable by
+ default (because typeless)
+ nullableProperty:
+ type: string
+ description: Some typed property that is deliberately made nullable
+ nullable: true
+ OrderWithTimestamp:
+ allOf:
+ - $ref: '#/components/schemas/Order'
+ - type: object
+ properties:
+ timestamp:
+ type: string
+ format: date-time
+ OneOfWithDiscriminatorAndMapping:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ discriminator:
+ propertyName: sodaType
+ mapping:
+ Cola: '#/components/schemas/Cola'
+ Fanta: '#/components/schemas/Fanta'
+ OneOfWithDiscriminator:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ discriminator:
+ propertyName: sodaType
+ OneOf:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ AnyOf:
+ anyOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ AllOf:
+ allOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ Cola:
+ type: object
+ properties:
+ sodaType:
+ type: string
+ caffeine:
+ type: boolean
+ Fanta:
+ type: object
+ properties:
+ sodaType:
+ type: string
+ color:
+ type: string
+paths:
+ /sodas:
+ get:
+ summary: Get all soda products
+ tags:
+ - Sodas
+ security:
+ - apiKeyAuth: []
+ responses:
+ '200':
+ description: A list of soda products
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/SodaWithId'
+ put:
+ summary: Update a specific soda product by ID
+ tags:
+ - Sodas
+ security:
+ - apiKeyAuth: []
+ requestBody:
+ description: The updated soda product
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SodaWithId'
+ responses:
+ '200':
+ description: The updated soda product
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Soda'
+ '204':
+ description: Nothing has changed
+ '404':
+ description: Soda product not found
+ /sodas/{id}:
+ get:
+ summary: Get a specific soda product by ID
+ tags:
+ - Sodas
+ security:
+ - apiKeyAuth: []
+ parameters:
+ - name: id
+ in: path
+ description: ID of the soda product to retrieve
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: The soda product
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SodaWithId'
+ '404':
+ description: Soda product not found
+ /orders:
+ post:
+ summary: Create a new order
+ tags:
+ - Orders
+ security:
+ - apiKeyAuth: []
+ requestBody:
+ description: The order details
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ responses:
+ '201':
+ description: The created order
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+security:
+ - apiKeyAuth: []
+ - bearerAuth: []
diff --git a/datamodel/openapi/openapi-api-sample/src/test/java/com/sap/cloud/sdk/datamodel/openapi/sample/api/OneOfDeserializationTest.java b/datamodel/openapi/openapi-api-sample/src/test/java/com/sap/cloud/sdk/datamodel/openapi/sample/api/OneOfDeserializationTest.java
new file mode 100644
index 000000000..a40aff759
--- /dev/null
+++ b/datamodel/openapi/openapi-api-sample/src/test/java/com/sap/cloud/sdk/datamodel/openapi/sample/api/OneOfDeserializationTest.java
@@ -0,0 +1,117 @@
+package com.sap.cloud.sdk.datamodel.openapi.sample.api;
+
+import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
+
+import javax.annotation.Nonnull;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.exc.InvalidTypeIdException;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.sap.cloud.sdk.datamodel.openapi.sample.model.AllOf;
+import com.sap.cloud.sdk.datamodel.openapi.sample.model.AnyOf;
+import com.sap.cloud.sdk.datamodel.openapi.sample.model.Cola;
+import com.sap.cloud.sdk.datamodel.openapi.sample.model.Fanta;
+import com.sap.cloud.sdk.datamodel.openapi.sample.model.OneOf;
+import com.sap.cloud.sdk.datamodel.openapi.sample.model.OneOfWithDiscriminator;
+import com.sap.cloud.sdk.datamodel.openapi.sample.model.OneOfWithDiscriminatorAndMapping;
+
+public class OneOfDeserializationTest
+{
+ String cola = """
+ {
+ "sodaType": "Cola",
+ "caffeine": true
+ }""";
+ String fanta = """
+ {
+ "sodaType": "Fanta",
+ "color": "orange"
+ }""";
+
+ @Test
+ void oneOf()
+ {
+ // useOneOfInterfaces is enabled and no discriminator is present, the deserialization will fail
+ // The fix is to use set a mixIn in the ObjectMapper
+ assertThatThrownBy(() -> newDefaultObjectMapper().readValue(cola, OneOf.class))
+ .isInstanceOf(InvalidTypeIdException.class)
+ .hasMessageContaining("Could not resolve subtype");
+ assertThatThrownBy(() -> newDefaultObjectMapper().readValue(fanta, OneOf.class))
+ .isInstanceOf(InvalidTypeIdException.class)
+ .hasMessageContaining("Could not resolve subtype");
+ }
+
+ @Test
+ void oneOfWithDiscriminator()
+ throws JsonProcessingException
+ {
+ Cola oneOfCola = (Cola) newDefaultObjectMapper().readValue(cola, OneOfWithDiscriminator.class);
+ assertThat(oneOfCola.getSodaType()).isEqualTo("Cola");
+ assertThat(oneOfCola.isCaffeine()).isTrue();
+
+ Fanta oneOfFanta = (Fanta) newDefaultObjectMapper().readValue(fanta, OneOfWithDiscriminator.class);
+ assertThat(oneOfFanta.getSodaType()).isEqualTo("Fanta");
+ assertThat(oneOfFanta.getColor()).isEqualTo("orange");
+ }
+
+ @Test
+ void oneOfWithDiscriminatorAndMapping()
+ throws JsonProcessingException
+ {
+ Cola oneOfCola = (Cola) newDefaultObjectMapper().readValue(cola, OneOfWithDiscriminatorAndMapping.class);
+ assertThat(oneOfCola.getSodaType()).isEqualTo("Cola");
+ assertThat(oneOfCola.isCaffeine()).isTrue();
+
+ Fanta oneOfFanta = (Fanta) newDefaultObjectMapper().readValue(fanta, OneOfWithDiscriminatorAndMapping.class);
+ assertThat(oneOfFanta.getSodaType()).isEqualTo("Fanta");
+ assertThat(oneOfFanta.getColor()).isEqualTo("orange");
+ }
+
+ @Test
+ void anyOf()
+ throws JsonProcessingException
+ {
+ AnyOf anyOfCola = newDefaultObjectMapper().readValue(cola, AnyOf.class);
+ assertThat(anyOfCola.getSodaType()).isEqualTo("Cola");
+ assertThat(anyOfCola.isCaffeine()).isTrue();
+
+ AnyOf anyOfFanta = newDefaultObjectMapper().readValue(fanta, AnyOf.class);
+ assertThat(anyOfFanta.getSodaType()).isEqualTo("Fanta");
+ assertThat(anyOfFanta.getColor()).isEqualTo("orange");
+ }
+
+ @Test
+ void allOf()
+ throws JsonProcessingException
+ {
+ AllOf allOfCola = newDefaultObjectMapper().readValue(cola, AllOf.class);
+ assertThat(allOfCola.getSodaType()).isEqualTo("Cola");
+ assertThat(allOfCola.isCaffeine()).isTrue();
+ assertThat(allOfCola.getColor()).isNull();
+
+ AllOf allOfFanta = newDefaultObjectMapper().readValue(fanta, AllOf.class);
+ assertThat(allOfFanta.getSodaType()).isEqualTo("Fanta");
+ assertThat(allOfFanta.getColor()).isEqualTo("orange");
+ assertThat(allOfFanta.isCaffeine()).isNull();
+ }
+
+ /**
+ * Taken from {@link com.sap.cloud.sdk.services.openapi.apiclient.ApiClient}
+ */
+ @Nonnull
+ private static ObjectMapper newDefaultObjectMapper()
+ {
+ return new Jackson2ObjectMapperBuilder()
+ .modules(new JavaTimeModule())
+ .visibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.NONE)
+ .visibility(PropertyAccessor.SETTER, JsonAutoDetect.Visibility.NONE)
+ .build();
+ }
+}
diff --git a/datamodel/openapi/openapi-generator-maven-plugin/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorMojo.java b/datamodel/openapi/openapi-generator-maven-plugin/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorMojo.java
index b1e2f7714..3de241031 100644
--- a/datamodel/openapi/openapi-generator-maven-plugin/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorMojo.java
+++ b/datamodel/openapi/openapi-generator-maven-plugin/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorMojo.java
@@ -118,6 +118,18 @@ public class DataModelGeneratorMojo extends AbstractMojo
@Parameter( property = "openapi.generate.enableOneOfAnyOfGeneration", defaultValue = "false" )
private boolean enableOneOfAnyOfGeneration;
+ /**
+ * Generate model classes. Default is true.
+ */
+ @Parameter( property = "openapi.generate.generateModels", defaultValue = "true" )
+ private boolean generateModels;
+
+ /**
+ * Generate API classes (client classes). Default is true.
+ */
+ @Parameter( property = "openapi.generate.generateApis", defaultValue = "true" )
+ private boolean generateApis;
+
/**
* Defines a list of additional properties that will be passed to the Java generator.
*/
@@ -179,6 +191,8 @@ Try retrieveGenerationConfiguration()
.deleteOutputDirectory(deleteOutputDirectory)
.additionalProperties(additionalProperties)
.oneOfAnyOfGenerationEnabled(enableOneOfAnyOfGeneration)
+ .generateModels(generateModels)
+ .generateApis(generateApis)
.build());
}
diff --git a/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/NewSoda.java b/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/NewSoda.java
index 9cd21bc5c..9d804a8b2 100644
--- a/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/NewSoda.java
+++ b/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/NewSoda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.datamodel.rest.sodastore.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -75,7 +73,8 @@ public class NewSoda
* Get name
* @return name The name of this {@link NewSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -103,7 +102,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link NewSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -131,7 +131,8 @@ public void setBrand( @Nonnull final String brand) {
* Get flavor
* @return flavor The flavor of this {@link NewSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -159,7 +160,8 @@ public void setFlavor( @Nonnull final String flavor) {
* Get price
* @return price The price of this {@link NewSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -254,6 +256,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/Soda.java b/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/Soda.java
index 86b6a86cf..ce1a59379 100644
--- a/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/Soda.java
+++ b/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/Soda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.datamodel.rest.sodastore.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -78,7 +76,8 @@ public class Soda
* Get id
* @return id The id of this {@link Soda} instance.
*/
- @Nonnull public Long getId() {
+ @Nonnull
+ public Long getId() {
return id;
}
@@ -106,7 +105,8 @@ public void setId( @Nullable final Long id) {
* Get name
* @return name The name of this {@link Soda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -134,7 +134,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link Soda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -162,7 +163,8 @@ public void setBrand( @Nonnull final String brand) {
* Get flavor
* @return flavor The flavor of this {@link Soda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -190,7 +192,8 @@ public void setFlavor( @Nonnull final String flavor) {
* Get price
* @return price The price of this {@link Soda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -287,6 +290,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/UpdateSoda.java b/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/UpdateSoda.java
index 80c92dc10..46a6d284a 100644
--- a/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/UpdateSoda.java
+++ b/datamodel/openapi/openapi-generator-maven-plugin/src/test/resources/DataModelGeneratorMojoIntegrationTest/sodastore/output/com/sap/cloud/sdk/datamodel/rest/sodastore/model/UpdateSoda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.datamodel.rest.sodastore.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -75,7 +73,8 @@ public class UpdateSoda
* Get name
* @return name The name of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -103,7 +102,8 @@ public void setName( @Nullable final String name) {
* Get brand
* @return brand The brand of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -131,7 +131,8 @@ public void setBrand( @Nullable final String brand) {
* Get flavor
* @return flavor The flavor of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -159,7 +160,8 @@ public void setFlavor( @Nullable final String flavor) {
* Get price
* @return price The price of this {@link UpdateSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -254,6 +256,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java
index 0ffa68832..eff6ff4bc 100644
--- a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java
+++ b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java
@@ -56,7 +56,7 @@ static ClientOptInput convertGenerationConfiguration(
@Nonnull final GenerationConfiguration generationConfiguration,
@Nonnull final Path inputSpec )
{
- setGlobalSettings();
+ setGlobalSettings(generationConfiguration);
final var inputSpecFile = inputSpec.toString();
final var config = createCodegenConfig();
@@ -96,10 +96,14 @@ public OperationsMap postProcessOperationsWithModels(
};
}
- private static void setGlobalSettings()
+ private static void setGlobalSettings( @Nonnull final GenerationConfiguration configuration )
{
- GlobalSettings.setProperty(CodegenConstants.APIS, "");
- GlobalSettings.setProperty(CodegenConstants.MODELS, "");
+ if( configuration.isGenerateApis() ) {
+ GlobalSettings.setProperty(CodegenConstants.APIS, "");
+ }
+ if( configuration.isGenerateModels() ) {
+ GlobalSettings.setProperty(CodegenConstants.MODELS, "");
+ }
GlobalSettings.setProperty(CodegenConstants.MODEL_TESTS, Boolean.FALSE.toString());
GlobalSettings.setProperty(CodegenConstants.MODEL_DOCS, Boolean.FALSE.toString());
GlobalSettings.setProperty(CodegenConstants.API_TESTS, Boolean.FALSE.toString());
@@ -136,7 +140,7 @@ private static Map getAdditionalProperties( @Nonnull final Gener
if( !Strings.isNullOrEmpty(copyrightHeader) ) {
result.put(COPYRIGHT_PROPERTY_KEY, copyrightHeader);
}
- result.put(CodegenConstants.SERIALIZABLE_MODEL, "true");
+ result.put(CodegenConstants.SERIALIZABLE_MODEL, "false");
result.put(JAVA_8_PROPERTY_KEY, "true");
result.put(DATE_LIBRARY_PROPERTY_KEY, "java8");
result.put(BOOLEAN_GETTER_PREFIX_PROPERTY_KEY, "is");
diff --git a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/PreprocessingStepOrchestrator.java b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/PreprocessingStepOrchestrator.java
index 8b3d6ca3b..e33d3225e 100644
--- a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/PreprocessingStepOrchestrator.java
+++ b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/PreprocessingStepOrchestrator.java
@@ -5,7 +5,6 @@
package com.sap.cloud.sdk.datamodel.openapi.generator;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
@@ -51,17 +50,14 @@ class PreprocessingStepOrchestrator
* {@code anyOfOneOfGenerationEnabled}
*
* @param anyOfOneOfGenerationEnabled
+ * true if clients should be generated for input specification with oneOf, anyOf
*
* @return this
*/
- PreprocessingStepOrchestrator enableAnyOfOneOfGeneration( @Nonnull final boolean anyOfOneOfGenerationEnabled )
+ PreprocessingStepOrchestrator enableAnyOfOneOfGeneration( final boolean anyOfOneOfGenerationEnabled )
{
if( !anyOfOneOfGenerationEnabled ) {
steps.add(ValidationKeywordsPreprocessor::new);
- } else {
- log
- .warn(
- "oneOf/anyOf keywords processing is turned on, the generated client may not be feature complete and work as expected for all cases involving anyOf/oneOf");
}
return this;
}
@@ -115,7 +111,7 @@ private Path writeProcessedSpecToTempFile( @Nonnull final JsonNode rootNode, @No
"." + fileFormat.getFileExtensions().get(0));
final String content = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(rootNode);
- Files.write(path, content.getBytes(StandardCharsets.UTF_8));
+ Files.writeString(path, content);
return path.normalize().toAbsolutePath();
}
diff --git a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/model/GenerationConfiguration.java b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/model/GenerationConfiguration.java
index 8ad9bb9b8..51e0e1765 100644
--- a/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/model/GenerationConfiguration.java
+++ b/datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/model/GenerationConfiguration.java
@@ -56,6 +56,12 @@ public class GenerationConfiguration
@Builder.Default
boolean oneOfAnyOfGenerationEnabled = false;
+ @Builder.Default
+ boolean generateModels = true;
+
+ @Builder.Default
+ boolean generateApis = true;
+
/**
* Indicates whether to use the default SAP copyright header for generated files.
*
diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/model.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/model.mustache
index 11bc4795e..1ce0b522e 100644
--- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/model.mustache
+++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/model.mustache
@@ -10,11 +10,11 @@ package {{package}};
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
{{/useReflectionEqualsHashCode}}
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
{{#imports}}
import {{import}};
@@ -27,14 +27,33 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
{{#withXml}}
import com.fasterxml.jackson.dataformat.xml.annotation.*;
{{/withXml}}
+{{#vendorExtensions.x-has-readonly-properties}}
+import com.fasterxml.jackson.annotation.JsonCreator;
+{{/vendorExtensions.x-has-readonly-properties}}
{{/jackson}}
{{#withXml}}
import {{javaxPackage}}.xml.bind.annotation.*;
+import {{javaxPackage}}.xml.bind.annotation.adapters.*;
+import io.github.threetenjaxb.core.*;
{{/withXml}}
+{{#jsonb}}
+import java.lang.reflect.Type;
+import {{javaxPackage}}.json.bind.annotation.JsonbTypeDeserializer;
+import {{javaxPackage}}.json.bind.annotation.JsonbTypeSerializer;
+import {{javaxPackage}}.json.bind.serializer.DeserializationContext;
+import {{javaxPackage}}.json.bind.serializer.JsonbDeserializer;
+import {{javaxPackage}}.json.bind.serializer.JsonbSerializer;
+import {{javaxPackage}}.json.bind.serializer.SerializationContext;
+import {{javaxPackage}}.json.stream.JsonGenerator;
+import {{javaxPackage}}.json.stream.JsonParser;
+import {{javaxPackage}}.json.bind.annotation.JsonbProperty;
+{{#vendorExtensions.x-has-readonly-properties}}
+import {{javaxPackage}}.json.bind.annotation.JsonbCreator;
+{{/vendorExtensions.x-has-readonly-properties}}
+{{/jsonb}}
{{#parcelableModel}}
import android.os.Parcelable;
import android.os.Parcel;
@@ -57,6 +76,6 @@ import {{javaxPackage}}.annotation.Nullable;
{{#models}}
{{#model}}
-{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}}
+{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#vendorExtensions.x-is-one-of-interface}}{{>oneof_interface}}{{/vendorExtensions.x-is-one-of-interface}}{{^vendorExtensions.x-is-one-of-interface}}{{>pojo}}{{/vendorExtensions.x-is-one-of-interface}}{{/isEnum}}
{{/model}}
{{/models}}
diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelEnum.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelEnum.mustache
index 6de2249ab..af40d5209 100644
--- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelEnum.mustache
+++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelEnum.mustache
@@ -2,10 +2,27 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
{{/jackson}}
+{{#gson}}
+import java.io.IOException;
+import com.google.gson.TypeAdapter;
+import com.google.gson.annotations.JsonAdapter;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+{{/gson}}
+{{#isUri}}
+import java.net.URI;
+{{/isUri}}
/**
* {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
*/
+{{#gson}}
+@JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class)
+{{/gson}}
+{{#jsonb}}
+@JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class)
+@JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class)
+{{/jsonb}}
{{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
{{#allowableValues}}{{#enumVars}}
{{#enumDescription}}
@@ -61,6 +78,42 @@ import com.fasterxml.jackson.annotation.JsonValue;
}
{{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}}
}
+{{#gson}}
+
+ public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> {
+ @Override
+ public void write(final JsonWriter jsonWriter, final {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} enumeration) throws IOException {
+ jsonWriter.value(enumeration.getValue(){{#isUri}}.toASCIIString(){{/isUri}});
+ }
+
+ @Override
+ public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException {
+ {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}}{{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}};
+ return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}});
+ }
+ }
+{{/gson}}
+{{#jsonb}}
+
+ public static final class Deserializer implements JsonbDeserializer<{{datatypeWithEnum}}> {
+ @Override
+ public {{datatypeWithEnum}} deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {
+ for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
+ if (String.valueOf(b.value).equals(parser.getString())) {
+ return b;
+ }
+ }
+ {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + parser.getString() + "'");{{/useNullForUnknownEnumValue}}
+ }
+ }
+
+ public static final class Serializer implements JsonbSerializer<{{datatypeWithEnum}}> {
+ @Override
+ public void serialize({{datatypeWithEnum}} obj, JsonGenerator generator, SerializationContext ctx) {
+ generator.write(obj.value);
+ }
+ }
+{{/jsonb}}
{{#supportUrlQuery}}
/**
diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelInnerEnum.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelInnerEnum.mustache
index 7785a086a..2472a72c4 100644
--- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelInnerEnum.mustache
+++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/modelInnerEnum.mustache
@@ -1,6 +1,13 @@
/**
* {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
*/
+{{#gson}}
+ @JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.Adapter.class)
+{{/gson}}
+{{#jsonb}}
+ @JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class)
+ @JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class)
+{{/jsonb}}
{{#withXml}}
@XmlType(name="{{datatypeWithEnum}}")
@XmlEnum({{dataType}}.class)
@@ -66,4 +73,39 @@
}
{{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}}
}
+{{#gson}}
+
+ public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}> {
+ @Override
+ public void write(final JsonWriter jsonWriter, final {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} enumeration) throws IOException {
+ jsonWriter.value(enumeration.getValue(){{#isUri}}.toASCIIString(){{/isUri}});
+ }
+
+ @Override
+ public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException {
+ {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}} {{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}};
+ return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}});
+ }
+ }
+{{/gson}}
+{{#jsonb}}
+ public static final class Deserializer implements JsonbDeserializer<{{datatypeWithEnum}}> {
+ @Override
+ public {{datatypeWithEnum}} deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {
+ for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
+ if (String.valueOf(b.value).equals(parser.getString())) {
+ return b;
+ }
+ }
+ {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + parser.getString() + "'");{{/useNullForUnknownEnumValue}}
+ }
+ }
+
+ public static final class Serializer implements JsonbSerializer<{{datatypeWithEnum}}> {
+ @Override
+ public void serialize({{datatypeWithEnum}} obj, JsonGenerator generator, SerializationContext ctx) {
+ generator.write(obj.value);
+ }
+ }
+{{/jsonb}}
}
diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/oneof_interface.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/oneof_interface.mustache
new file mode 100644
index 000000000..985c14de2
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/oneof_interface.mustache
@@ -0,0 +1,11 @@
+/**
+ * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}}
+ * @deprecated{{/isDeprecated}}
+ */{{#isDeprecated}}
+@Deprecated{{/isDeprecated}}
+{{>additionalOneOfTypeAnnotations}}{{>typeInfoAnnotation}}{{>xmlAnnotation}}
+public interface {{classname}} {{#vendorExtensions.x-implements}}{{#-first}}extends {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
+ {{#discriminator}}
+ public {{propertyType}} {{propertyGetter}}();
+ {{/discriminator}}
+}
diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojo.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojo.mustache
index c364e1373..3f43f0bad 100644
--- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojo.mustache
+++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/pojo.mustache
@@ -2,13 +2,30 @@
* {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}}
* @deprecated{{/isDeprecated}}
*/{{#isDeprecated}}
-@Deprecated{{/isDeprecated}}{{#discriminator}}
-{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}{{^isReleased}}
-@Beta{{/isReleased}}
-// CHECKSTYLE:OFF
-public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcelableModel}}implements Parcelable {{/parcelableModel}}{{^parcelableModel}}{{/parcelableModel}}
+@Deprecated{{/isDeprecated}}
+{{#swagger1AnnotationLibrary}}
+{{#description}}
+@ApiModel(description = "{{{.}}}")
+{{/description}}
+{{/swagger1AnnotationLibrary}}
+{{#swagger2AnnotationLibrary}}
+{{#description}}
+@Schema(description = "{{{.}}}")
+{{/description}}
+{{/swagger2AnnotationLibrary}}
+{{#jackson}}
+{{#isClassnameSanitized}}
+{{/isClassnameSanitized}}
+{{/jackson}}
+{{>additionalModelTypeAnnotations}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}{{^isReleased}}
+@Beta{{/isReleased}}// CHECKSTYLE:OFF
+public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}
// CHECKSTYLE:ON
{
+{{#serializableModel}}
+ private static final long serialVersionUID = 1L;
+
+{{/serializableModel}}
{{#vars}}
{{#isEnum}}
{{^isContainer}}
@@ -22,40 +39,40 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
{{/isEnum}}
{{#jackson}}
@JsonProperty("{{baseName}}")
- {{#withXml}}
- {{^isContainer}}
- @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
- {{/isContainer}}
- {{#isContainer}}
- {{#isXmlWrapped}}
- // items.xmlName={{items.xmlName}}
- @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{items.baseName}}{{/items.xmlName}}")
- {{/isXmlWrapped}}
- {{/isContainer}}
- {{/withXml}}
{{/jackson}}
{{#withXml}}
- {{#isXmlAttribute}}
- @XmlAttribute(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
- {{/isXmlAttribute}}
- {{^isXmlAttribute}}
- {{^isContainer}}
- @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
- {{/isContainer}}
- {{#isContainer}}
- // Is a container wrapped={{isXmlWrapped}}
- {{#items}}
- // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}}
- // items.example={{example}} items.type={{dataType}}
- @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
- {{/items}}
- {{#isXmlWrapped}}
- @XmlElementWrapper({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
- {{/isXmlWrapped}}
- {{/isContainer}}
- {{/isXmlAttribute}}
+ @Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}})
+ {{#isXmlWrapped}}
+ @XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}})
+ {{/isXmlWrapped}}
+ {{^isXmlAttribute}}
+ {{#isDateTime}}
+ @XmlJavaTypeAdapter(OffsetDateTimeXmlAdapter.class)
+ {{/isDateTime}}
+ {{/isXmlAttribute}}
{{/withXml}}
- private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
+ {{#gson}}
+ @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
+ {{/gson}}
+ {{#vendorExtensions.x-field-extra-annotation}}
+ {{{vendorExtensions.x-field-extra-annotation}}}
+ {{/vendorExtensions.x-field-extra-annotation}}
+ {{#vendorExtensions.x-is-jackson-optional-nullable}}
+ {{#isContainer}}
+ {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();
+ {{/isContainer}}
+ {{^isContainer}}
+ {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}};
+ {{/isContainer}}
+ {{/vendorExtensions.x-is-jackson-optional-nullable}}
+ {{^vendorExtensions.x-is-jackson-optional-nullable}}
+ {{#isContainer}}
+ {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
+ {{/isContainer}}
+ {{^isContainer}}
+ {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
+ {{/isContainer}}
+ {{/vendorExtensions.x-is-jackson-optional-nullable}}
{{/vars}}
@JsonAnySetter
@@ -63,9 +80,17 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
private final Map cloudSdkCustomFields = new LinkedHashMap<>();
{{#parcelableModel}}
public {{classname}}() {
- {{#parent}}
- super();
- {{/parent}}
+ {{#parent}}
+ {{#parcelableModel}}
+ super();{{/parcelableModel}}
+ {{/parent}}
+ {{#gson}}
+ {{#discriminator}}
+ {{#discriminator.isEnum}}
+ this.{{{discriminatorName}}} = this.getClass().getSimpleName();
+ {{/discriminator.isEnum}}
+ {{/discriminator}}
+ {{/gson}}
}
{{/parcelableModel}}
{{^parcelableModel}}
@@ -102,11 +127,24 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
* @return The same instance of type {@link {{classname}}}
*/
@Nonnull public {{classname}} add{{nameInPascalCase}}Item( @Nonnull final {{{items.datatypeWithEnum}}} {{name}}Item) {
+ {{#vendorExtensions.x-is-jackson-optional-nullable}}
+ if (this.{{name}} == null || !this.{{name}}.isPresent()) {
+ this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}});
+ }
+ try {
+ this.{{name}}.get().add({{name}}Item);
+ } catch (java.util.NoSuchElementException e) {
+ // this can never happen, as we make sure above that the value is present
+ }
+ return this;
+ {{/vendorExtensions.x-is-jackson-optional-nullable}}
+ {{^vendorExtensions.x-is-jackson-optional-nullable}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}};
}
this.{{name}}.add({{name}}Item);
return this;
+ {{/vendorExtensions.x-is-jackson-optional-nullable}}
}
{{/isArray}}
{{#isMap}}
@@ -118,9 +156,26 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
* @return The same instance of type {@link {{classname}}}
*/
@Nonnull public {{classname}} put{{nameInCamelCase}}Item( @Nonnull final String key, {{#items.isNullable}}@Nullable{{/items.isNullable}}{{^items.isNullable}}@Nonnull{{/items.isNullable}} final {{{items.datatypeWithEnum}}} {{name}}Item) {
- this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}};
+ {{#vendorExtensions.x-is-jackson-optional-nullable}}
+ if (this.{{name}} == null || !this.{{name}}.isPresent()) {
+ this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}});
+ }
+ try {
+ this.{{name}}.get().put(key, {{name}}Item);
+ } catch (java.util.NoSuchElementException e) {
+ // this can never happen, as we make sure above that the value is present
+ }
+ return this;
+ {{/vendorExtensions.x-is-jackson-optional-nullable}}
+ {{^vendorExtensions.x-is-jackson-optional-nullable}}
+ {{^required}}
+ if (this.{{name}} == null) {
+ this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}};
+ }
+ {{/required}}
this.{{name}}.put(key, {{name}}Item);
return this;
+ {{/vendorExtensions.x-is-jackson-optional-nullable}}
}
{{/isMap}}
@@ -139,17 +194,35 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
* maximum: {{.}}
{{/maximum}}
* @return {{name}} The {{name}} of this {@link {{classname}}} instance.
- {{#deprecated}}
+ {{#deprecated}}
* @deprecated
- {{/deprecated}}
+ {{/deprecated}}
*/
- {{#deprecated}}
+{{#deprecated}}
@Deprecated
- {{/deprecated}}
-{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}}{{#vendorExtensions.extraAnnotation}}
- {{{vendorExtensions.extraAnnotation}}}
-{{/vendorExtensions.extraAnnotation}}
- {{#isNullable}}@Nullable{{/isNullable}}{{^isNullable}}@Nonnull{{/isNullable}} public {{{datatypeWithEnum}}} {{getter}}() {
+{{/deprecated}}
+{{#isNullable}}
+ @Nullable
+{{/isNullable}}
+{{^isNullable}}
+ @Nonnull
+{{/isNullable}}
+{{#jsonb}}
+ @JsonbProperty("{{baseName}}")
+{{/jsonb}}
+{{#useBeanValidation}}
+{{>beanValidation}}
+{{/useBeanValidation}}
+{{#swagger1AnnotationLibrary}}
+ @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
+{{/swagger1AnnotationLibrary}}
+{{#swagger2AnnotationLibrary}}
+ @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}")
+{{/swagger2AnnotationLibrary}}
+{{#vendorExtensions.x-extra-annotation}}
+ {{{vendorExtensions.x-extra-annotation}}}
+{{/vendorExtensions.x-extra-annotation}}
+ public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}}{{#isByteArray}}.clone(){{/isByteArray}};
}
{{^isReadOnly}}
@@ -209,7 +282,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
{{#parent}}
- {{#allVars}}
+ {{#readWriteVars}}
{{#isOverridden}}
@Override
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
@@ -223,7 +296,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
}
{{/isOverridden}}
- {{/allVars}}
+ {{/readWriteVars}}
{{/parent}}
@Override
public boolean equals(@Nullable final java.lang.Object o) {
@@ -274,12 +347,23 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
{{/parent}}
{{#vars}}
- sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
+ sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n");
{{/vars}}
cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
sb.append("}");
return sb.toString();
}
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
{{#supportUrlQuery}}
/**
@@ -474,18 +558,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
return joiner.toString();
}
{{/supportUrlQuery}}
-
- /**
- * Convert the given object to string with each line indented by 4 spaces
- * (except the first line).
- */
- private String toIndentedString(final java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-
{{#parcelableModel}}
public void writeToParcel(Parcel out, int flags) {
diff --git a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/typeInfoAnnotation.mustache b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/typeInfoAnnotation.mustache
index b7f87b12c..cd480eee3 100644
--- a/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/typeInfoAnnotation.mustache
+++ b/datamodel/openapi/openapi-generator/src/main/resources/openapi-generator/mustache-templates/typeInfoAnnotation.mustache
@@ -1,6 +1,6 @@
{{#jackson}}
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true)
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true)
{{#discriminator.mappedModels}}
{{#-first}}
@JsonSubTypes({
@@ -10,7 +10,4 @@
})
{{/-last}}
{{/discriminator.mappedModels}}
-{{#isClassnameSanitized}}
-@JsonTypeName("{{name}}")
-{{/isClassnameSanitized}}
-{{/jackson}}
\ No newline at end of file
+{{/jackson}}
diff --git a/datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorIntegrationTest.java b/datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorIntegrationTest.java
index 092859209..bbbadc189 100644
--- a/datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorIntegrationTest.java
+++ b/datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorIntegrationTest.java
@@ -36,6 +36,7 @@ private enum TestCase
"com.sap.cloud.sdk.services.builder.model",
ApiMaturity.RELEASED,
true,
+ true,
6,
Map.of("aiSdkConstructor", "true")),
API_CLASS_VENDOR_EXTENSION_YAML(
@@ -45,6 +46,7 @@ private enum TestCase
"com.sap.cloud.sdk.services.apiclassvendorextension.model",
ApiMaturity.RELEASED,
false,
+ true,
4,
Map.of()),
API_CLASS_VENDOR_EXTENSION_JSON(
@@ -54,6 +56,7 @@ private enum TestCase
"com.sap.cloud.sdk.services.apiclassvendorextension.model",
ApiMaturity.RELEASED,
false,
+ true,
6,
Map.of()),
INPUT_SPEC_WITH_UPPERCASE_FILE_EXTENSION(
@@ -63,17 +66,29 @@ private enum TestCase
"com.sap.cloud.sdk.services.uppercasefileextension.model",
ApiMaturity.RELEASED,
false,
+ true,
6,
Map.of()),
- INPUT_SPEC_WITH_ANYOF_ONEOF(
- "input-spec-with-anyof-oneof",
- "AggregatorNestedSchemaChild.json",
- "com.sap.cloud.sdk.services.anyofoneof.api",
- "com.sap.cloud.sdk.services.anyofoneof.model",
+ ONE_OF_INTERFACES_DISABLED(
+ "oneof-interfaces-disabled",
+ "sodastore.yaml",
+ "test",
+ "test",
ApiMaturity.RELEASED,
+ false,
true,
- 7,
+ 8,
Map.of()),
+ ONE_OF_INTERFACES_ENABLED(
+ "oneof-interfaces-enabled",
+ "sodastore.yaml",
+ "test",
+ "test",
+ ApiMaturity.RELEASED,
+ true,
+ true,
+ 8,
+ Map.of("useOneOfInterfaces", "true")),
INPUT_SPEC_WITH_BUILDER(
"input-spec-with-builder",
"sodastore.JSON",
@@ -81,6 +96,7 @@ private enum TestCase
"com.sap.cloud.sdk.services.builder.model",
ApiMaturity.RELEASED,
true,
+ true,
6,
Map
.of(
@@ -97,6 +113,7 @@ private enum TestCase
"com.sap.cloud.sdk.services.builder.model",
ApiMaturity.RELEASED,
true,
+ true,
6,
Map
.of(
@@ -105,7 +122,17 @@ private enum TestCase
"removeOperationIdPrefixDelimiter",
"\\.",
"removeOperationIdPrefixCount",
- "3")),;
+ "3")),
+ GENERATE_APIS(
+ "generate-apis",
+ "sodastore.yaml",
+ "test",
+ "test",
+ ApiMaturity.RELEASED,
+ true,
+ false,
+ 7,
+ Map.of());
final String testCaseName;
final String inputSpecFileName;
@@ -113,6 +140,7 @@ private enum TestCase
final String modelPackageName;
final ApiMaturity apiMaturity;
final boolean anyOfOneOfGenerationEnabled;
+ final boolean generateApis;
final int expectedNumberOfGeneratedFiles;
final Map additionalProperties;
}
@@ -136,6 +164,7 @@ void integrationTests( final TestCase testCase, @TempDir final Path path )
GenerationConfiguration
.builder()
.apiPackage(testCase.apiPackageName)
+ .generateApis(testCase.generateApis)
.modelPackage(testCase.modelPackageName)
.inputSpec(inputDirectory.resolve(testCase.inputSpecFileName).toAbsolutePath().toString())
.apiMaturity(testCase.apiMaturity)
@@ -169,6 +198,7 @@ void generateDataModelForComparison( final TestCase testCase )
GenerationConfiguration
.builder()
.apiPackage(testCase.apiPackageName)
+ .generateApis(testCase.generateApis)
.modelPackage(testCase.modelPackageName)
.inputSpec(inputDirectory.resolve(testCase.inputSpecFileName).toAbsolutePath().toString())
.apiMaturity(testCase.apiMaturity)
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java
index 8bb5485d3..98a68c017 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java
@@ -16,11 +16,11 @@
package com.sap.cloud.sdk.services.builder.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -28,12 +28,10 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.LocalDate;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -82,7 +80,8 @@ public class NewSoda
* Get name
* @return name The name of this {@link NewSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -110,7 +109,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link NewSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -138,7 +138,8 @@ public void setBrand( @Nonnull final String brand) {
* Get zero
* @return zero The zero of this {@link NewSoda} instance.
*/
- @Nonnull public Boolean isZero() {
+ @Nonnull
+ public Boolean isZero() {
return zero;
}
@@ -166,7 +167,8 @@ public void setZero( @Nullable final Boolean zero) {
* Get since
* @return since The since of this {@link NewSoda} instance.
*/
- @Nonnull public LocalDate getSince() {
+ @Nonnull
+ public LocalDate getSince() {
return since;
}
@@ -194,7 +196,8 @@ public void setSince( @Nullable final LocalDate since) {
* Get flavor
* @return flavor The flavor of this {@link NewSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -222,7 +225,8 @@ public void setFlavor( @Nonnull final String flavor) {
* Get price
* @return price The price of this {@link NewSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -321,6 +325,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/Soda.java
index d5ef9dbed..86941bb48 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/Soda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/Soda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.builder.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -78,7 +76,8 @@ public class Soda
* Get id
* @return id The id of this {@link Soda} instance.
*/
- @Nonnull public Long getId() {
+ @Nonnull
+ public Long getId() {
return id;
}
@@ -106,7 +105,8 @@ public void setId( @Nullable final Long id) {
* Get name
* @return name The name of this {@link Soda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -134,7 +134,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link Soda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -162,7 +163,8 @@ public void setBrand( @Nonnull final String brand) {
* Get flavor
* @return flavor The flavor of this {@link Soda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -190,7 +192,8 @@ public void setFlavor( @Nonnull final String flavor) {
* Get price
* @return price The price of this {@link Soda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -287,6 +290,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java
index d377a9c63..bad1c631c 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java
@@ -16,11 +16,11 @@
package com.sap.cloud.sdk.services.builder.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -28,12 +28,10 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.LocalDate;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -82,7 +80,8 @@ public class UpdateSoda
* Get name
* @return name The name of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -110,7 +109,8 @@ public void setName( @Nullable final String name) {
* Get zero
* @return zero The zero of this {@link UpdateSoda} instance.
*/
- @Nonnull public Boolean isZero() {
+ @Nonnull
+ public Boolean isZero() {
return zero;
}
@@ -138,7 +138,8 @@ public void setZero( @Nullable final Boolean zero) {
* Get since
* @return since The since of this {@link UpdateSoda} instance.
*/
- @Nonnull public LocalDate getSince() {
+ @Nonnull
+ public LocalDate getSince() {
return since;
}
@@ -166,7 +167,8 @@ public void setSince( @Nullable final LocalDate since) {
* Get brand
* @return brand The brand of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -194,7 +196,8 @@ public void setBrand( @Nullable final String brand) {
* Get flavor
* @return flavor The flavor of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -222,7 +225,8 @@ public void setFlavor( @Nullable final String flavor) {
* Get price
* @return price The price of this {@link UpdateSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -321,6 +325,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java
index fcd71eef3..65ae0c16d 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java
@@ -16,11 +16,11 @@
package com.sap.cloud.sdk.services.apiclassvendorextension.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -28,12 +28,10 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.LocalDate;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -82,7 +80,8 @@ public class NewSoda
* Get name
* @return name The name of this {@link NewSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -110,7 +109,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link NewSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -138,7 +138,8 @@ public void setBrand( @Nonnull final String brand) {
* Get zero
* @return zero The zero of this {@link NewSoda} instance.
*/
- @Nonnull public Boolean isZero() {
+ @Nonnull
+ public Boolean isZero() {
return zero;
}
@@ -166,7 +167,8 @@ public void setZero( @Nullable final Boolean zero) {
* Get since
* @return since The since of this {@link NewSoda} instance.
*/
- @Nonnull public LocalDate getSince() {
+ @Nonnull
+ public LocalDate getSince() {
return since;
}
@@ -194,7 +196,8 @@ public void setSince( @Nullable final LocalDate since) {
* Get flavor
* @return flavor The flavor of this {@link NewSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -222,7 +225,8 @@ public void setFlavor( @Nonnull final String flavor) {
* Get price
* @return price The price of this {@link NewSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -321,6 +325,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java
index febbd2475..fb29e78ee 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.apiclassvendorextension.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -78,7 +76,8 @@ public class Soda
* Get id
* @return id The id of this {@link Soda} instance.
*/
- @Nonnull public Long getId() {
+ @Nonnull
+ public Long getId() {
return id;
}
@@ -106,7 +105,8 @@ public void setId( @Nullable final Long id) {
* Get name
* @return name The name of this {@link Soda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -134,7 +134,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link Soda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -162,7 +163,8 @@ public void setBrand( @Nonnull final String brand) {
* Get flavor
* @return flavor The flavor of this {@link Soda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -190,7 +192,8 @@ public void setFlavor( @Nonnull final String flavor) {
* Get price
* @return price The price of this {@link Soda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -287,6 +290,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java
index 0beed4af4..8a543cf92 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-json/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java
@@ -16,11 +16,11 @@
package com.sap.cloud.sdk.services.apiclassvendorextension.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -28,12 +28,10 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.LocalDate;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -82,7 +80,8 @@ public class UpdateSoda
* Get name
* @return name The name of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -110,7 +109,8 @@ public void setName( @Nullable final String name) {
* Get zero
* @return zero The zero of this {@link UpdateSoda} instance.
*/
- @Nonnull public Boolean isZero() {
+ @Nonnull
+ public Boolean isZero() {
return zero;
}
@@ -138,7 +138,8 @@ public void setZero( @Nullable final Boolean zero) {
* Get since
* @return since The since of this {@link UpdateSoda} instance.
*/
- @Nonnull public LocalDate getSince() {
+ @Nonnull
+ public LocalDate getSince() {
return since;
}
@@ -166,7 +167,8 @@ public void setSince( @Nullable final LocalDate since) {
* Get brand
* @return brand The brand of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -194,7 +196,8 @@ public void setBrand( @Nullable final String brand) {
* Get flavor
* @return flavor The flavor of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -222,7 +225,8 @@ public void setFlavor( @Nullable final String flavor) {
* Get price
* @return price The price of this {@link UpdateSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -321,6 +325,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java
index ec3318c33..2622c27a6 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/NewSoda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.apiclassvendorextension.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -75,7 +73,8 @@ public class NewSoda
* Get name
* @return name The name of this {@link NewSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -103,7 +102,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link NewSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -131,7 +131,8 @@ public void setBrand( @Nonnull final String brand) {
* Get flavor
* @return flavor The flavor of this {@link NewSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -159,7 +160,8 @@ public void setFlavor( @Nonnull final String flavor) {
* Get price
* @return price The price of this {@link NewSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -254,6 +256,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java
index febbd2475..fb29e78ee 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/Soda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.apiclassvendorextension.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -78,7 +76,8 @@ public class Soda
* Get id
* @return id The id of this {@link Soda} instance.
*/
- @Nonnull public Long getId() {
+ @Nonnull
+ public Long getId() {
return id;
}
@@ -106,7 +105,8 @@ public void setId( @Nullable final Long id) {
* Get name
* @return name The name of this {@link Soda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -134,7 +134,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link Soda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -162,7 +163,8 @@ public void setBrand( @Nonnull final String brand) {
* Get flavor
* @return flavor The flavor of this {@link Soda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -190,7 +192,8 @@ public void setFlavor( @Nonnull final String flavor) {
* Get price
* @return price The price of this {@link Soda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -287,6 +290,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java
index cde2b37e7..28ab26bc0 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-vendor-extension-yaml/output/com/sap/cloud/sdk/services/apiclassvendorextension/model/UpdateSoda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.apiclassvendorextension.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -75,7 +73,8 @@ public class UpdateSoda
* Get name
* @return name The name of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -103,7 +102,8 @@ public void setName( @Nullable final String name) {
* Get brand
* @return brand The brand of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -131,7 +131,8 @@ public void setBrand( @Nullable final String brand) {
* Get flavor
* @return flavor The flavor of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -159,7 +160,8 @@ public void setFlavor( @Nullable final String flavor) {
* Get price
* @return price The price of this {@link UpdateSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -254,6 +256,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/input/sodastore.yaml b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/input/sodastore.yaml
new file mode 100644
index 000000000..470276795
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/input/sodastore.yaml
@@ -0,0 +1,58 @@
+openapi: 3.0.0
+info:
+ title: Soda Store API
+ version: 1.0.0
+ description: API for managing sodas in a soda store
+paths:
+ /sodas:
+ get:
+ summary: Get a list of all sodas
+ operationId: getSodas
+ responses:
+ '200':
+ description: A list of sodas
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/OneOf'
+components:
+ schemas:
+ OneOfWithDiscriminatorAndMapping:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ discriminator:
+ propertyName: sodaType
+ mapping:
+ Cola: '#/components/schemas/Cola'
+ Fanta: '#/components/schemas/Fanta'
+ OneOfWithDiscriminator:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ discriminator:
+ propertyName: sodaType
+ OneOf:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ AnyOf:
+ anyOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ AllOf:
+ allOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ Cola:
+ type: object
+ properties:
+ sodaType:
+ type: string
+ Fanta:
+ type: object
+ properties:
+ sodaType:
+ type: string
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/AllOf.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/AllOf.java
new file mode 100644
index 000000000..a2c60509f
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/AllOf.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * AllOf
+ */
+// CHECKSTYLE:OFF
+public class AllOf
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link AllOf} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link AllOf}
+ * @return The same instance of this {@link AllOf} class
+ */
+ @Nonnull public AllOf sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link AllOf} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link AllOf} instance.
+ *
+ * @param sodaType The sodaType of this {@link AllOf}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link AllOf}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link AllOf} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("AllOf has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link AllOf} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final AllOf allOf = (AllOf) o;
+ return Objects.equals(this.cloudSdkCustomFields, allOf.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, allOf.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AllOf {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/AnyOf.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/AnyOf.java
new file mode 100644
index 000000000..879569438
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/AnyOf.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import test.Cola;
+import test.Fanta;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * AnyOf
+ */
+// CHECKSTYLE:OFF
+public class AnyOf
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link AnyOf} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link AnyOf}
+ * @return The same instance of this {@link AnyOf} class
+ */
+ @Nonnull public AnyOf sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link AnyOf} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link AnyOf} instance.
+ *
+ * @param sodaType The sodaType of this {@link AnyOf}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link AnyOf}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link AnyOf} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("AnyOf has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link AnyOf} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final AnyOf anyOf = (AnyOf) o;
+ return Objects.equals(this.cloudSdkCustomFields, anyOf.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, anyOf.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AnyOf {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/Cola.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/Cola.java
new file mode 100644
index 000000000..a2adbf686
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/Cola.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * Cola
+ */
+// CHECKSTYLE:OFF
+public class Cola
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link Cola} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link Cola}
+ * @return The same instance of this {@link Cola} class
+ */
+ @Nonnull public Cola sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link Cola} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link Cola} instance.
+ *
+ * @param sodaType The sodaType of this {@link Cola}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link Cola}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link Cola} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("Cola has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link Cola} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final Cola cola = (Cola) o;
+ return Objects.equals(this.cloudSdkCustomFields, cola.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, cola.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class Cola {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/Fanta.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/Fanta.java
new file mode 100644
index 000000000..c6359bba1
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/Fanta.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * Fanta
+ */
+// CHECKSTYLE:OFF
+public class Fanta
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link Fanta} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link Fanta}
+ * @return The same instance of this {@link Fanta} class
+ */
+ @Nonnull public Fanta sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link Fanta} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link Fanta} instance.
+ *
+ * @param sodaType The sodaType of this {@link Fanta}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link Fanta}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link Fanta} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("Fanta has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link Fanta} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final Fanta fanta = (Fanta) o;
+ return Objects.equals(this.cloudSdkCustomFields, fanta.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, fanta.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class Fanta {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/OneOf.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/OneOf.java
new file mode 100644
index 000000000..7ad1e3e0a
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/OneOf.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import test.Cola;
+import test.Fanta;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * OneOf
+ */
+// CHECKSTYLE:OFF
+public class OneOf
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link OneOf} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link OneOf}
+ * @return The same instance of this {@link OneOf} class
+ */
+ @Nonnull public OneOf sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link OneOf} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link OneOf} instance.
+ *
+ * @param sodaType The sodaType of this {@link OneOf}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link OneOf}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link OneOf} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("OneOf has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link OneOf} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final OneOf oneOf = (OneOf) o;
+ return Objects.equals(this.cloudSdkCustomFields, oneOf.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, oneOf.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class OneOf {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/RootObject.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/OneOfWithDiscriminator.java
similarity index 57%
rename from datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/RootObject.java
rename to datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/OneOfWithDiscriminator.java
index ab58f486e..9a17581c0 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/RootObject.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/OneOfWithDiscriminator.java
@@ -3,8 +3,8 @@
*/
/*
- * Sample API
- * API for managing root and child objects
+ * Soda Store API
+ * API for managing sodas in a soda store
*
* The version of the OpenAPI document: 1.0.0
*
@@ -14,89 +14,83 @@
* Do not edit the class manually.
*/
-package com.sap.cloud.sdk.services.anyofoneof.model;
+package test;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import com.sap.cloud.sdk.services.anyofoneof.model.RootObjectQuestionsInner;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.io.Serializable;
+import test.Cola;
+import test.Fanta;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
- * RootObject
+ * OneOfWithDiscriminator
*/
+
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "sodaType", visible = true)
+@JsonSubTypes({
+ @JsonSubTypes.Type(value = Cola.class, name = "Cola"),
+ @JsonSubTypes.Type(value = Fanta.class, name = "Fanta"),
+})
// CHECKSTYLE:OFF
-public class RootObject
+public class OneOfWithDiscriminator
// CHECKSTYLE:ON
{
- @JsonProperty("questions")
- private List questions = new ArrayList<>();
+ @JsonProperty("sodaType")
+ private String sodaType;
@JsonAnySetter
@JsonAnyGetter
private final Map cloudSdkCustomFields = new LinkedHashMap<>();
/**
- * Set the questions of this {@link RootObject} instance and return the same instance.
+ * Set the sodaType of this {@link OneOfWithDiscriminator} instance and return the same instance.
*
- * @param questions The questions of this {@link RootObject}
- * @return The same instance of this {@link RootObject} class
- */
- @Nonnull public RootObject questions( @Nullable final List questions) {
- this.questions = questions;
- return this;
- }
- /**
- * Add one questions instance to this {@link RootObject}.
- * @param questionsItem The questions that should be added
- * @return The same instance of type {@link RootObject}
+ * @param sodaType The sodaType of this {@link OneOfWithDiscriminator}
+ * @return The same instance of this {@link OneOfWithDiscriminator} class
*/
- @Nonnull public RootObject addQuestionsItem( @Nonnull final RootObjectQuestionsInner questionsItem) {
- if (this.questions == null) {
- this.questions = new ArrayList<>();
- }
- this.questions.add(questionsItem);
+ @Nonnull public OneOfWithDiscriminator sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
return this;
}
/**
- * Get questions
- * @return questions The questions of this {@link RootObject} instance.
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link OneOfWithDiscriminator} instance.
*/
- @Nonnull public List getQuestions() {
- return questions;
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
}
/**
- * Set the questions of this {@link RootObject} instance.
+ * Set the sodaType of this {@link OneOfWithDiscriminator} instance.
*
- * @param questions The questions of this {@link RootObject}
+ * @param sodaType The sodaType of this {@link OneOfWithDiscriminator}
*/
- public void setQuestions( @Nullable final List questions) {
- this.questions = questions;
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
}
/**
- * Get the names of the unrecognizable properties of the {@link RootObject}.
+ * Get the names of the unrecognizable properties of the {@link OneOfWithDiscriminator}.
* @return The set of properties names
*/
@JsonIgnore
@@ -106,7 +100,7 @@ public Set getCustomFieldNames() {
}
/**
- * Get the value of an unrecognizable property of this {@link RootObject} instance.
+ * Get the value of an unrecognizable property of this {@link OneOfWithDiscriminator} instance.
* @param name The name of the property
* @return The value of the property
* @throws NoSuchElementException If no property with the given name could be found.
@@ -114,13 +108,13 @@ public Set getCustomFieldNames() {
@Nullable
public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
if( !cloudSdkCustomFields.containsKey(name) ) {
- throw new NoSuchElementException("RootObject has no field with name '" + name + "'.");
+ throw new NoSuchElementException("OneOfWithDiscriminator has no field with name '" + name + "'.");
}
return cloudSdkCustomFields.get(name);
}
/**
- * Set an unrecognizable property of this {@link RootObject} instance. If the map previously contained a mapping
+ * Set an unrecognizable property of this {@link OneOfWithDiscriminator} instance. If the map previously contained a mapping
* for the key, the old value is replaced by the specified value.
* @param customFieldName The name of the property
* @param customFieldValue The value of the property
@@ -140,21 +134,21 @@ public boolean equals(@Nullable final java.lang.Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
- final RootObject rootObject = (RootObject) o;
- return Objects.equals(this.cloudSdkCustomFields, rootObject.cloudSdkCustomFields) &&
- Objects.equals(this.questions, rootObject.questions);
+ final OneOfWithDiscriminator oneOfWithDiscriminator = (OneOfWithDiscriminator) o;
+ return Objects.equals(this.cloudSdkCustomFields, oneOfWithDiscriminator.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, oneOfWithDiscriminator.sodaType);
}
@Override
public int hashCode() {
- return Objects.hash(questions, cloudSdkCustomFields);
+ return Objects.hash(sodaType, cloudSdkCustomFields);
}
@Override
@Nonnull public String toString() {
final StringBuilder sb = new StringBuilder();
- sb.append("class RootObject {\n");
- sb.append(" questions: ").append(toIndentedString(questions)).append("\n");
+ sb.append("class OneOfWithDiscriminator {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
sb.append("}");
return sb.toString();
@@ -171,6 +165,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/OneOfWithDiscriminatorAndMapping.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/OneOfWithDiscriminatorAndMapping.java
new file mode 100644
index 000000000..37a3763f4
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/generate-apis/output/test/OneOfWithDiscriminatorAndMapping.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import test.Cola;
+import test.Fanta;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * OneOfWithDiscriminatorAndMapping
+ */
+
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "sodaType", visible = true)
+@JsonSubTypes({
+ @JsonSubTypes.Type(value = Cola.class, name = "Cola"),
+ @JsonSubTypes.Type(value = Fanta.class, name = "Fanta"),
+})
+// CHECKSTYLE:OFF
+public class OneOfWithDiscriminatorAndMapping
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link OneOfWithDiscriminatorAndMapping} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link OneOfWithDiscriminatorAndMapping}
+ * @return The same instance of this {@link OneOfWithDiscriminatorAndMapping} class
+ */
+ @Nonnull public OneOfWithDiscriminatorAndMapping sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link OneOfWithDiscriminatorAndMapping} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link OneOfWithDiscriminatorAndMapping} instance.
+ *
+ * @param sodaType The sodaType of this {@link OneOfWithDiscriminatorAndMapping}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link OneOfWithDiscriminatorAndMapping}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link OneOfWithDiscriminatorAndMapping} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("OneOfWithDiscriminatorAndMapping has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link OneOfWithDiscriminatorAndMapping} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final OneOfWithDiscriminatorAndMapping oneOfWithDiscriminatorAndMapping = (OneOfWithDiscriminatorAndMapping) o;
+ return Objects.equals(this.cloudSdkCustomFields, oneOfWithDiscriminatorAndMapping.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, oneOfWithDiscriminatorAndMapping.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class OneOfWithDiscriminatorAndMapping {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/input/AggregatorNestedSchemaChild.json b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/input/AggregatorNestedSchemaChild.json
deleted file mode 100644
index bfa73118b..000000000
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/input/AggregatorNestedSchemaChild.json
+++ /dev/null
@@ -1,115 +0,0 @@
-{
- "x-sap-api-type": "REST",
- "x-sap-shortText": "This is a sample API to test the Cloud SDK's OpenAPI generator.",
- "x-sap-stateInfo": {
- "state": "Active"
- },
- "openapi": "3.0.3",
- "info": {
- "title": "Sample API",
- "version": "1.0.0",
- "description": "API for managing root and child objects"
- },
- "paths": {
- "/some/endpoint": {
- "post": {
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/RootObject"
- }
- }
- }
- },
- "responses": {
- "201": {
- "description": "Something was created.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/RootObject"
- }
- }
- }
- },
- "400": {
- "description": "Request was invalid."
- },
- "401": {
- "description": "Authentication Error"
- }
- }
- }
- }
- },
- "components": {
- "schemas": {
- "RootObject": {
- "type": "object",
- "properties": {
- "questions": {
- "type": "array",
- "items": {
- "oneOf": [
- {
- "$ref": "#/components/schemas/ChildObject1"
- },
- {
- "$ref": "#/components/schemas/ChildObject2"
- },
- {
- "$ref": "#/components/schemas/ChildObject3"
- }
- ]
- }
- }
- }
- },
- "ChildObject1": {
- "allOf": [
- {
- "$ref": "#/components/schemas/NestedChildObject"
- },
- {
- "type": "string"
- }
- ]
- },
- "ChildObject2": {
- "oneOf": [
- {
- "$ref": "#/components/schemas/NestedChildObject"
- },
- {
- "type": "string"
- }
- ]
- },
- "ChildObject3": {
- "anyOf": [
- {
- "$ref": "#/components/schemas/NestedChildObject"
- },
- {
- "type": "string"
- }
- ]
- },
- "NestedChildObject": {
- "type": "object",
- "properties": {
- "id": {
- "type": "string"
- },
- "type": {
- "type": "string"
- },
- "text": {
- "type": "string"
- }
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/ChildObject1.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/ChildObject1.java
deleted file mode 100644
index cc169338f..000000000
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/ChildObject1.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
- */
-
-/*
- * Sample API
- * API for managing root and child objects
- *
- * The version of the OpenAPI document: 1.0.0
- *
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-package com.sap.cloud.sdk.services.anyofoneof.model;
-
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Objects;
-import java.util.Set;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-/**
- * ChildObject1
- */
-// CHECKSTYLE:OFF
-public class ChildObject1
-// CHECKSTYLE:ON
-{
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("type")
- private String type;
-
- @JsonProperty("text")
- private String text;
-
- @JsonAnySetter
- @JsonAnyGetter
- private final Map cloudSdkCustomFields = new LinkedHashMap<>();
-
- /**
- * Set the id of this {@link ChildObject1} instance and return the same instance.
- *
- * @param id The id of this {@link ChildObject1}
- * @return The same instance of this {@link ChildObject1} class
- */
- @Nonnull public ChildObject1 id( @Nullable final String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Get id
- * @return id The id of this {@link ChildObject1} instance.
- */
- @Nonnull public String getId() {
- return id;
- }
-
- /**
- * Set the id of this {@link ChildObject1} instance.
- *
- * @param id The id of this {@link ChildObject1}
- */
- public void setId( @Nullable final String id) {
- this.id = id;
- }
-
- /**
- * Set the type of this {@link ChildObject1} instance and return the same instance.
- *
- * @param type The type of this {@link ChildObject1}
- * @return The same instance of this {@link ChildObject1} class
- */
- @Nonnull public ChildObject1 type( @Nullable final String type) {
- this.type = type;
- return this;
- }
-
- /**
- * Get type
- * @return type The type of this {@link ChildObject1} instance.
- */
- @Nonnull public String getType() {
- return type;
- }
-
- /**
- * Set the type of this {@link ChildObject1} instance.
- *
- * @param type The type of this {@link ChildObject1}
- */
- public void setType( @Nullable final String type) {
- this.type = type;
- }
-
- /**
- * Set the text of this {@link ChildObject1} instance and return the same instance.
- *
- * @param text The text of this {@link ChildObject1}
- * @return The same instance of this {@link ChildObject1} class
- */
- @Nonnull public ChildObject1 text( @Nullable final String text) {
- this.text = text;
- return this;
- }
-
- /**
- * Get text
- * @return text The text of this {@link ChildObject1} instance.
- */
- @Nonnull public String getText() {
- return text;
- }
-
- /**
- * Set the text of this {@link ChildObject1} instance.
- *
- * @param text The text of this {@link ChildObject1}
- */
- public void setText( @Nullable final String text) {
- this.text = text;
- }
-
- /**
- * Get the names of the unrecognizable properties of the {@link ChildObject1}.
- * @return The set of properties names
- */
- @JsonIgnore
- @Nonnull
- public Set getCustomFieldNames() {
- return cloudSdkCustomFields.keySet();
- }
-
- /**
- * Get the value of an unrecognizable property of this {@link ChildObject1} instance.
- * @param name The name of the property
- * @return The value of the property
- * @throws NoSuchElementException If no property with the given name could be found.
- */
- @Nullable
- public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
- if( !cloudSdkCustomFields.containsKey(name) ) {
- throw new NoSuchElementException("ChildObject1 has no field with name '" + name + "'.");
- }
- return cloudSdkCustomFields.get(name);
- }
-
- /**
- * Set an unrecognizable property of this {@link ChildObject1} instance. If the map previously contained a mapping
- * for the key, the old value is replaced by the specified value.
- * @param customFieldName The name of the property
- * @param customFieldValue The value of the property
- */
- @JsonIgnore
- public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
- {
- cloudSdkCustomFields.put(customFieldName, customFieldValue);
- }
-
-
- @Override
- public boolean equals(@Nullable final java.lang.Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- final ChildObject1 childObject1 = (ChildObject1) o;
- return Objects.equals(this.cloudSdkCustomFields, childObject1.cloudSdkCustomFields) &&
- Objects.equals(this.id, childObject1.id) &&
- Objects.equals(this.type, childObject1.type) &&
- Objects.equals(this.text, childObject1.text);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, type, text, cloudSdkCustomFields);
- }
-
- @Override
- @Nonnull public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("class ChildObject1 {\n");
- sb.append(" id: ").append(toIndentedString(id)).append("\n");
- sb.append(" type: ").append(toIndentedString(type)).append("\n");
- sb.append(" text: ").append(toIndentedString(text)).append("\n");
- cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces
- * (except the first line).
- */
- private String toIndentedString(final java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-
-
-}
-
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/ChildObject2.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/ChildObject2.java
deleted file mode 100644
index 32affc7cc..000000000
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/ChildObject2.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
- */
-
-/*
- * Sample API
- * API for managing root and child objects
- *
- * The version of the OpenAPI document: 1.0.0
- *
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-package com.sap.cloud.sdk.services.anyofoneof.model;
-
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Objects;
-import java.util.Set;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import com.sap.cloud.sdk.services.anyofoneof.model.NestedChildObject;
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-/**
- * ChildObject2
- */
-// CHECKSTYLE:OFF
-public class ChildObject2
-// CHECKSTYLE:ON
-{
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("type")
- private String type;
-
- @JsonProperty("text")
- private String text;
-
- @JsonAnySetter
- @JsonAnyGetter
- private final Map cloudSdkCustomFields = new LinkedHashMap<>();
-
- /**
- * Set the id of this {@link ChildObject2} instance and return the same instance.
- *
- * @param id The id of this {@link ChildObject2}
- * @return The same instance of this {@link ChildObject2} class
- */
- @Nonnull public ChildObject2 id( @Nullable final String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Get id
- * @return id The id of this {@link ChildObject2} instance.
- */
- @Nonnull public String getId() {
- return id;
- }
-
- /**
- * Set the id of this {@link ChildObject2} instance.
- *
- * @param id The id of this {@link ChildObject2}
- */
- public void setId( @Nullable final String id) {
- this.id = id;
- }
-
- /**
- * Set the type of this {@link ChildObject2} instance and return the same instance.
- *
- * @param type The type of this {@link ChildObject2}
- * @return The same instance of this {@link ChildObject2} class
- */
- @Nonnull public ChildObject2 type( @Nullable final String type) {
- this.type = type;
- return this;
- }
-
- /**
- * Get type
- * @return type The type of this {@link ChildObject2} instance.
- */
- @Nonnull public String getType() {
- return type;
- }
-
- /**
- * Set the type of this {@link ChildObject2} instance.
- *
- * @param type The type of this {@link ChildObject2}
- */
- public void setType( @Nullable final String type) {
- this.type = type;
- }
-
- /**
- * Set the text of this {@link ChildObject2} instance and return the same instance.
- *
- * @param text The text of this {@link ChildObject2}
- * @return The same instance of this {@link ChildObject2} class
- */
- @Nonnull public ChildObject2 text( @Nullable final String text) {
- this.text = text;
- return this;
- }
-
- /**
- * Get text
- * @return text The text of this {@link ChildObject2} instance.
- */
- @Nonnull public String getText() {
- return text;
- }
-
- /**
- * Set the text of this {@link ChildObject2} instance.
- *
- * @param text The text of this {@link ChildObject2}
- */
- public void setText( @Nullable final String text) {
- this.text = text;
- }
-
- /**
- * Get the names of the unrecognizable properties of the {@link ChildObject2}.
- * @return The set of properties names
- */
- @JsonIgnore
- @Nonnull
- public Set getCustomFieldNames() {
- return cloudSdkCustomFields.keySet();
- }
-
- /**
- * Get the value of an unrecognizable property of this {@link ChildObject2} instance.
- * @param name The name of the property
- * @return The value of the property
- * @throws NoSuchElementException If no property with the given name could be found.
- */
- @Nullable
- public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
- if( !cloudSdkCustomFields.containsKey(name) ) {
- throw new NoSuchElementException("ChildObject2 has no field with name '" + name + "'.");
- }
- return cloudSdkCustomFields.get(name);
- }
-
- /**
- * Set an unrecognizable property of this {@link ChildObject2} instance. If the map previously contained a mapping
- * for the key, the old value is replaced by the specified value.
- * @param customFieldName The name of the property
- * @param customFieldValue The value of the property
- */
- @JsonIgnore
- public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
- {
- cloudSdkCustomFields.put(customFieldName, customFieldValue);
- }
-
-
- @Override
- public boolean equals(@Nullable final java.lang.Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- final ChildObject2 childObject2 = (ChildObject2) o;
- return Objects.equals(this.cloudSdkCustomFields, childObject2.cloudSdkCustomFields) &&
- Objects.equals(this.id, childObject2.id) &&
- Objects.equals(this.type, childObject2.type) &&
- Objects.equals(this.text, childObject2.text);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, type, text, cloudSdkCustomFields);
- }
-
- @Override
- @Nonnull public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("class ChildObject2 {\n");
- sb.append(" id: ").append(toIndentedString(id)).append("\n");
- sb.append(" type: ").append(toIndentedString(type)).append("\n");
- sb.append(" text: ").append(toIndentedString(text)).append("\n");
- cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces
- * (except the first line).
- */
- private String toIndentedString(final java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-
-
-}
-
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/ChildObject3.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/ChildObject3.java
deleted file mode 100644
index 1d5f13a2b..000000000
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/ChildObject3.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
- */
-
-/*
- * Sample API
- * API for managing root and child objects
- *
- * The version of the OpenAPI document: 1.0.0
- *
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-package com.sap.cloud.sdk.services.anyofoneof.model;
-
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Objects;
-import java.util.Set;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import com.sap.cloud.sdk.services.anyofoneof.model.NestedChildObject;
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-/**
- * ChildObject3
- */
-// CHECKSTYLE:OFF
-public class ChildObject3
-// CHECKSTYLE:ON
-{
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("type")
- private String type;
-
- @JsonProperty("text")
- private String text;
-
- @JsonAnySetter
- @JsonAnyGetter
- private final Map cloudSdkCustomFields = new LinkedHashMap<>();
-
- /**
- * Set the id of this {@link ChildObject3} instance and return the same instance.
- *
- * @param id The id of this {@link ChildObject3}
- * @return The same instance of this {@link ChildObject3} class
- */
- @Nonnull public ChildObject3 id( @Nullable final String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Get id
- * @return id The id of this {@link ChildObject3} instance.
- */
- @Nonnull public String getId() {
- return id;
- }
-
- /**
- * Set the id of this {@link ChildObject3} instance.
- *
- * @param id The id of this {@link ChildObject3}
- */
- public void setId( @Nullable final String id) {
- this.id = id;
- }
-
- /**
- * Set the type of this {@link ChildObject3} instance and return the same instance.
- *
- * @param type The type of this {@link ChildObject3}
- * @return The same instance of this {@link ChildObject3} class
- */
- @Nonnull public ChildObject3 type( @Nullable final String type) {
- this.type = type;
- return this;
- }
-
- /**
- * Get type
- * @return type The type of this {@link ChildObject3} instance.
- */
- @Nonnull public String getType() {
- return type;
- }
-
- /**
- * Set the type of this {@link ChildObject3} instance.
- *
- * @param type The type of this {@link ChildObject3}
- */
- public void setType( @Nullable final String type) {
- this.type = type;
- }
-
- /**
- * Set the text of this {@link ChildObject3} instance and return the same instance.
- *
- * @param text The text of this {@link ChildObject3}
- * @return The same instance of this {@link ChildObject3} class
- */
- @Nonnull public ChildObject3 text( @Nullable final String text) {
- this.text = text;
- return this;
- }
-
- /**
- * Get text
- * @return text The text of this {@link ChildObject3} instance.
- */
- @Nonnull public String getText() {
- return text;
- }
-
- /**
- * Set the text of this {@link ChildObject3} instance.
- *
- * @param text The text of this {@link ChildObject3}
- */
- public void setText( @Nullable final String text) {
- this.text = text;
- }
-
- /**
- * Get the names of the unrecognizable properties of the {@link ChildObject3}.
- * @return The set of properties names
- */
- @JsonIgnore
- @Nonnull
- public Set getCustomFieldNames() {
- return cloudSdkCustomFields.keySet();
- }
-
- /**
- * Get the value of an unrecognizable property of this {@link ChildObject3} instance.
- * @param name The name of the property
- * @return The value of the property
- * @throws NoSuchElementException If no property with the given name could be found.
- */
- @Nullable
- public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
- if( !cloudSdkCustomFields.containsKey(name) ) {
- throw new NoSuchElementException("ChildObject3 has no field with name '" + name + "'.");
- }
- return cloudSdkCustomFields.get(name);
- }
-
- /**
- * Set an unrecognizable property of this {@link ChildObject3} instance. If the map previously contained a mapping
- * for the key, the old value is replaced by the specified value.
- * @param customFieldName The name of the property
- * @param customFieldValue The value of the property
- */
- @JsonIgnore
- public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
- {
- cloudSdkCustomFields.put(customFieldName, customFieldValue);
- }
-
-
- @Override
- public boolean equals(@Nullable final java.lang.Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- final ChildObject3 childObject3 = (ChildObject3) o;
- return Objects.equals(this.cloudSdkCustomFields, childObject3.cloudSdkCustomFields) &&
- Objects.equals(this.id, childObject3.id) &&
- Objects.equals(this.type, childObject3.type) &&
- Objects.equals(this.text, childObject3.text);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, type, text, cloudSdkCustomFields);
- }
-
- @Override
- @Nonnull public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("class ChildObject3 {\n");
- sb.append(" id: ").append(toIndentedString(id)).append("\n");
- sb.append(" type: ").append(toIndentedString(type)).append("\n");
- sb.append(" text: ").append(toIndentedString(text)).append("\n");
- cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces
- * (except the first line).
- */
- private String toIndentedString(final java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-
-
-}
-
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/NestedChildObject.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/NestedChildObject.java
deleted file mode 100644
index a63891588..000000000
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/NestedChildObject.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
- */
-
-/*
- * Sample API
- * API for managing root and child objects
- *
- * The version of the OpenAPI document: 1.0.0
- *
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-package com.sap.cloud.sdk.services.anyofoneof.model;
-
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Objects;
-import java.util.Set;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-/**
- * NestedChildObject
- */
-// CHECKSTYLE:OFF
-public class NestedChildObject
-// CHECKSTYLE:ON
-{
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("type")
- private String type;
-
- @JsonProperty("text")
- private String text;
-
- @JsonAnySetter
- @JsonAnyGetter
- private final Map cloudSdkCustomFields = new LinkedHashMap<>();
-
- /**
- * Set the id of this {@link NestedChildObject} instance and return the same instance.
- *
- * @param id The id of this {@link NestedChildObject}
- * @return The same instance of this {@link NestedChildObject} class
- */
- @Nonnull public NestedChildObject id( @Nullable final String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Get id
- * @return id The id of this {@link NestedChildObject} instance.
- */
- @Nonnull public String getId() {
- return id;
- }
-
- /**
- * Set the id of this {@link NestedChildObject} instance.
- *
- * @param id The id of this {@link NestedChildObject}
- */
- public void setId( @Nullable final String id) {
- this.id = id;
- }
-
- /**
- * Set the type of this {@link NestedChildObject} instance and return the same instance.
- *
- * @param type The type of this {@link NestedChildObject}
- * @return The same instance of this {@link NestedChildObject} class
- */
- @Nonnull public NestedChildObject type( @Nullable final String type) {
- this.type = type;
- return this;
- }
-
- /**
- * Get type
- * @return type The type of this {@link NestedChildObject} instance.
- */
- @Nonnull public String getType() {
- return type;
- }
-
- /**
- * Set the type of this {@link NestedChildObject} instance.
- *
- * @param type The type of this {@link NestedChildObject}
- */
- public void setType( @Nullable final String type) {
- this.type = type;
- }
-
- /**
- * Set the text of this {@link NestedChildObject} instance and return the same instance.
- *
- * @param text The text of this {@link NestedChildObject}
- * @return The same instance of this {@link NestedChildObject} class
- */
- @Nonnull public NestedChildObject text( @Nullable final String text) {
- this.text = text;
- return this;
- }
-
- /**
- * Get text
- * @return text The text of this {@link NestedChildObject} instance.
- */
- @Nonnull public String getText() {
- return text;
- }
-
- /**
- * Set the text of this {@link NestedChildObject} instance.
- *
- * @param text The text of this {@link NestedChildObject}
- */
- public void setText( @Nullable final String text) {
- this.text = text;
- }
-
- /**
- * Get the names of the unrecognizable properties of the {@link NestedChildObject}.
- * @return The set of properties names
- */
- @JsonIgnore
- @Nonnull
- public Set getCustomFieldNames() {
- return cloudSdkCustomFields.keySet();
- }
-
- /**
- * Get the value of an unrecognizable property of this {@link NestedChildObject} instance.
- * @param name The name of the property
- * @return The value of the property
- * @throws NoSuchElementException If no property with the given name could be found.
- */
- @Nullable
- public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
- if( !cloudSdkCustomFields.containsKey(name) ) {
- throw new NoSuchElementException("NestedChildObject has no field with name '" + name + "'.");
- }
- return cloudSdkCustomFields.get(name);
- }
-
- /**
- * Set an unrecognizable property of this {@link NestedChildObject} instance. If the map previously contained a mapping
- * for the key, the old value is replaced by the specified value.
- * @param customFieldName The name of the property
- * @param customFieldValue The value of the property
- */
- @JsonIgnore
- public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
- {
- cloudSdkCustomFields.put(customFieldName, customFieldValue);
- }
-
-
- @Override
- public boolean equals(@Nullable final java.lang.Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- final NestedChildObject nestedChildObject = (NestedChildObject) o;
- return Objects.equals(this.cloudSdkCustomFields, nestedChildObject.cloudSdkCustomFields) &&
- Objects.equals(this.id, nestedChildObject.id) &&
- Objects.equals(this.type, nestedChildObject.type) &&
- Objects.equals(this.text, nestedChildObject.text);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, type, text, cloudSdkCustomFields);
- }
-
- @Override
- @Nonnull public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("class NestedChildObject {\n");
- sb.append(" id: ").append(toIndentedString(id)).append("\n");
- sb.append(" type: ").append(toIndentedString(type)).append("\n");
- sb.append(" text: ").append(toIndentedString(text)).append("\n");
- cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces
- * (except the first line).
- */
- private String toIndentedString(final java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-
-
-}
-
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/RootObjectQuestionsInner.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/RootObjectQuestionsInner.java
deleted file mode 100644
index c3dd8933e..000000000
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/model/RootObjectQuestionsInner.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
- */
-
-/*
- * Sample API
- * API for managing root and child objects
- *
- * The version of the OpenAPI document: 1.0.0
- *
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-package com.sap.cloud.sdk.services.anyofoneof.model;
-
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Objects;
-import java.util.Set;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import com.sap.cloud.sdk.services.anyofoneof.model.ChildObject1;
-import com.sap.cloud.sdk.services.anyofoneof.model.ChildObject2;
-import com.sap.cloud.sdk.services.anyofoneof.model.ChildObject3;
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-/**
- * RootObjectQuestionsInner
- */
-// CHECKSTYLE:OFF
-public class RootObjectQuestionsInner
-// CHECKSTYLE:ON
-{
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("type")
- private String type;
-
- @JsonProperty("text")
- private String text;
-
- @JsonAnySetter
- @JsonAnyGetter
- private final Map cloudSdkCustomFields = new LinkedHashMap<>();
-
- /**
- * Set the id of this {@link RootObjectQuestionsInner} instance and return the same instance.
- *
- * @param id The id of this {@link RootObjectQuestionsInner}
- * @return The same instance of this {@link RootObjectQuestionsInner} class
- */
- @Nonnull public RootObjectQuestionsInner id( @Nullable final String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Get id
- * @return id The id of this {@link RootObjectQuestionsInner} instance.
- */
- @Nonnull public String getId() {
- return id;
- }
-
- /**
- * Set the id of this {@link RootObjectQuestionsInner} instance.
- *
- * @param id The id of this {@link RootObjectQuestionsInner}
- */
- public void setId( @Nullable final String id) {
- this.id = id;
- }
-
- /**
- * Set the type of this {@link RootObjectQuestionsInner} instance and return the same instance.
- *
- * @param type The type of this {@link RootObjectQuestionsInner}
- * @return The same instance of this {@link RootObjectQuestionsInner} class
- */
- @Nonnull public RootObjectQuestionsInner type( @Nullable final String type) {
- this.type = type;
- return this;
- }
-
- /**
- * Get type
- * @return type The type of this {@link RootObjectQuestionsInner} instance.
- */
- @Nonnull public String getType() {
- return type;
- }
-
- /**
- * Set the type of this {@link RootObjectQuestionsInner} instance.
- *
- * @param type The type of this {@link RootObjectQuestionsInner}
- */
- public void setType( @Nullable final String type) {
- this.type = type;
- }
-
- /**
- * Set the text of this {@link RootObjectQuestionsInner} instance and return the same instance.
- *
- * @param text The text of this {@link RootObjectQuestionsInner}
- * @return The same instance of this {@link RootObjectQuestionsInner} class
- */
- @Nonnull public RootObjectQuestionsInner text( @Nullable final String text) {
- this.text = text;
- return this;
- }
-
- /**
- * Get text
- * @return text The text of this {@link RootObjectQuestionsInner} instance.
- */
- @Nonnull public String getText() {
- return text;
- }
-
- /**
- * Set the text of this {@link RootObjectQuestionsInner} instance.
- *
- * @param text The text of this {@link RootObjectQuestionsInner}
- */
- public void setText( @Nullable final String text) {
- this.text = text;
- }
-
- /**
- * Get the names of the unrecognizable properties of the {@link RootObjectQuestionsInner}.
- * @return The set of properties names
- */
- @JsonIgnore
- @Nonnull
- public Set getCustomFieldNames() {
- return cloudSdkCustomFields.keySet();
- }
-
- /**
- * Get the value of an unrecognizable property of this {@link RootObjectQuestionsInner} instance.
- * @param name The name of the property
- * @return The value of the property
- * @throws NoSuchElementException If no property with the given name could be found.
- */
- @Nullable
- public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
- if( !cloudSdkCustomFields.containsKey(name) ) {
- throw new NoSuchElementException("RootObjectQuestionsInner has no field with name '" + name + "'.");
- }
- return cloudSdkCustomFields.get(name);
- }
-
- /**
- * Set an unrecognizable property of this {@link RootObjectQuestionsInner} instance. If the map previously contained a mapping
- * for the key, the old value is replaced by the specified value.
- * @param customFieldName The name of the property
- * @param customFieldValue The value of the property
- */
- @JsonIgnore
- public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
- {
- cloudSdkCustomFields.put(customFieldName, customFieldValue);
- }
-
-
- @Override
- public boolean equals(@Nullable final java.lang.Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- final RootObjectQuestionsInner rootObjectQuestionsInner = (RootObjectQuestionsInner) o;
- return Objects.equals(this.cloudSdkCustomFields, rootObjectQuestionsInner.cloudSdkCustomFields) &&
- Objects.equals(this.id, rootObjectQuestionsInner.id) &&
- Objects.equals(this.type, rootObjectQuestionsInner.type) &&
- Objects.equals(this.text, rootObjectQuestionsInner.text);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, type, text, cloudSdkCustomFields);
- }
-
- @Override
- @Nonnull public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("class RootObjectQuestionsInner {\n");
- sb.append(" id: ").append(toIndentedString(id)).append("\n");
- sb.append(" type: ").append(toIndentedString(type)).append("\n");
- sb.append(" text: ").append(toIndentedString(text)).append("\n");
- cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces
- * (except the first line).
- */
- private String toIndentedString(final java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-
-
-}
-
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java
index 2ab27da0e..7f740af26 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/NewSoda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.builder.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -79,7 +77,8 @@ private NewSoda() { }
* Get name
* @return name The name of this {@link NewSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -107,7 +106,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link NewSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -135,7 +135,8 @@ public void setBrand( @Nonnull final String brand) {
* Get flavor
* @return flavor The flavor of this {@link NewSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -163,7 +164,8 @@ public void setFlavor( @Nonnull final String flavor) {
* Get price
* @return price The price of this {@link NewSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -257,7 +259,6 @@ private String toIndentedString(final java.lang.Object o) {
}
return o.toString().replace("\n", "\n ");
}
-
/**
* Create a type-safe, fluent-api builder object to construct a new {@link NewSoda} instance with all required arguments.
*/
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/Soda.java
index cd089943b..5bcf303da 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/Soda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/Soda.java
@@ -16,11 +16,11 @@
package com.sap.cloud.sdk.services.builder.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -30,12 +30,10 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -85,7 +83,8 @@ private Soda() { }
* Get id
* @return id The id of this {@link Soda} instance.
*/
- @Nonnull public Long getId() {
+ @Nonnull
+ public Long getId() {
return id;
}
@@ -113,7 +112,8 @@ public void setId( @Nullable final Long id) {
* Get name
* @return name The name of this {@link Soda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -141,7 +141,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link Soda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -181,7 +182,8 @@ public void setBrand( @Nonnull final String brand) {
* Get flavors
* @return flavors The flavors of this {@link Soda} instance.
*/
- @Nonnull public List getFlavors() {
+ @Nonnull
+ public List getFlavors() {
return flavors;
}
@@ -209,7 +211,8 @@ public void setFlavors( @Nonnull final List flavors) {
* Get price
* @return price The price of this {@link Soda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -305,7 +308,6 @@ private String toIndentedString(final java.lang.Object o) {
}
return o.toString().replace("\n", "\n ");
}
-
/**
* Create a type-safe, fluent-api builder object to construct a new {@link Soda} instance with all required arguments.
*/
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java
index b4c2e100c..6cf426327 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-builder/output/com/sap/cloud/sdk/services/builder/model/UpdateSoda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.builder.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -79,7 +77,8 @@ private UpdateSoda() { }
* Get name
* @return name The name of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -107,7 +106,8 @@ public void setName( @Nullable final String name) {
* Get brand
* @return brand The brand of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -135,7 +135,8 @@ public void setBrand( @Nullable final String brand) {
* Get flavor
* @return flavor The flavor of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -163,7 +164,8 @@ public void setFlavor( @Nullable final String flavor) {
* Get price
* @return price The price of this {@link UpdateSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -257,7 +259,6 @@ private String toIndentedString(final java.lang.Object o) {
}
return o.toString().replace("\n", "\n ");
}
-
/**
* Create a new {@link UpdateSoda} instance. No arguments are required.
*/
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/NewSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/NewSoda.java
index 0e58e4ad4..8fb462951 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/NewSoda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/NewSoda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.uppercasefileextension.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -75,7 +73,8 @@ public class NewSoda
* Get name
* @return name The name of this {@link NewSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -103,7 +102,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link NewSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -131,7 +131,8 @@ public void setBrand( @Nonnull final String brand) {
* Get flavor
* @return flavor The flavor of this {@link NewSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -159,7 +160,8 @@ public void setFlavor( @Nonnull final String flavor) {
* Get price
* @return price The price of this {@link NewSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -254,6 +256,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/Soda.java
index 920ee5c40..f20e47df0 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/Soda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/Soda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.uppercasefileextension.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -78,7 +76,8 @@ public class Soda
* Get id
* @return id The id of this {@link Soda} instance.
*/
- @Nonnull public Long getId() {
+ @Nonnull
+ public Long getId() {
return id;
}
@@ -106,7 +105,8 @@ public void setId( @Nullable final Long id) {
* Get name
* @return name The name of this {@link Soda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -134,7 +134,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link Soda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -162,7 +163,8 @@ public void setBrand( @Nonnull final String brand) {
* Get flavor
* @return flavor The flavor of this {@link Soda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -190,7 +192,8 @@ public void setFlavor( @Nonnull final String flavor) {
* Get price
* @return price The price of this {@link Soda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -287,6 +290,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/UpdateSoda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/UpdateSoda.java
index 6c881a5f7..8d1691b8f 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/UpdateSoda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-uppercase-file-extension/output/com/sap/cloud/sdk/services/uppercasefileextension/model/UpdateSoda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.uppercasefileextension.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -75,7 +73,8 @@ public class UpdateSoda
* Get name
* @return name The name of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -103,7 +102,8 @@ public void setName( @Nullable final String name) {
* Get brand
* @return brand The brand of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -131,7 +131,8 @@ public void setBrand( @Nullable final String brand) {
* Get flavor
* @return flavor The flavor of this {@link UpdateSoda} instance.
*/
- @Nonnull public String getFlavor() {
+ @Nonnull
+ public String getFlavor() {
return flavor;
}
@@ -159,7 +160,8 @@ public void setFlavor( @Nullable final String flavor) {
* Get price
* @return price The price of this {@link UpdateSoda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -254,6 +256,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/input/sodastore.yaml b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/input/sodastore.yaml
new file mode 100644
index 000000000..470276795
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/input/sodastore.yaml
@@ -0,0 +1,58 @@
+openapi: 3.0.0
+info:
+ title: Soda Store API
+ version: 1.0.0
+ description: API for managing sodas in a soda store
+paths:
+ /sodas:
+ get:
+ summary: Get a list of all sodas
+ operationId: getSodas
+ responses:
+ '200':
+ description: A list of sodas
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/OneOf'
+components:
+ schemas:
+ OneOfWithDiscriminatorAndMapping:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ discriminator:
+ propertyName: sodaType
+ mapping:
+ Cola: '#/components/schemas/Cola'
+ Fanta: '#/components/schemas/Fanta'
+ OneOfWithDiscriminator:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ discriminator:
+ propertyName: sodaType
+ OneOf:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ AnyOf:
+ anyOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ AllOf:
+ allOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ Cola:
+ type: object
+ properties:
+ sodaType:
+ type: string
+ Fanta:
+ type: object
+ properties:
+ sodaType:
+ type: string
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/AllOf.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/AllOf.java
new file mode 100644
index 000000000..a2c60509f
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/AllOf.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * AllOf
+ */
+// CHECKSTYLE:OFF
+public class AllOf
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link AllOf} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link AllOf}
+ * @return The same instance of this {@link AllOf} class
+ */
+ @Nonnull public AllOf sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link AllOf} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link AllOf} instance.
+ *
+ * @param sodaType The sodaType of this {@link AllOf}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link AllOf}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link AllOf} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("AllOf has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link AllOf} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final AllOf allOf = (AllOf) o;
+ return Objects.equals(this.cloudSdkCustomFields, allOf.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, allOf.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AllOf {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/AnyOf.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/AnyOf.java
new file mode 100644
index 000000000..879569438
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/AnyOf.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import test.Cola;
+import test.Fanta;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * AnyOf
+ */
+// CHECKSTYLE:OFF
+public class AnyOf
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link AnyOf} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link AnyOf}
+ * @return The same instance of this {@link AnyOf} class
+ */
+ @Nonnull public AnyOf sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link AnyOf} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link AnyOf} instance.
+ *
+ * @param sodaType The sodaType of this {@link AnyOf}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link AnyOf}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link AnyOf} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("AnyOf has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link AnyOf} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final AnyOf anyOf = (AnyOf) o;
+ return Objects.equals(this.cloudSdkCustomFields, anyOf.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, anyOf.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AnyOf {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/Cola.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/Cola.java
new file mode 100644
index 000000000..a2adbf686
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/Cola.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * Cola
+ */
+// CHECKSTYLE:OFF
+public class Cola
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link Cola} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link Cola}
+ * @return The same instance of this {@link Cola} class
+ */
+ @Nonnull public Cola sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link Cola} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link Cola} instance.
+ *
+ * @param sodaType The sodaType of this {@link Cola}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link Cola}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link Cola} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("Cola has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link Cola} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final Cola cola = (Cola) o;
+ return Objects.equals(this.cloudSdkCustomFields, cola.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, cola.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class Cola {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/api/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/DefaultApi.java
similarity index 61%
rename from datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/api/DefaultApi.java
rename to datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/DefaultApi.java
index 1f3288fdf..424ff2c43 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/input-spec-with-anyof-oneof/output/com/sap/cloud/sdk/services/anyofoneof/api/DefaultApi.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/DefaultApi.java
@@ -2,14 +2,14 @@
* Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
*/
-package com.sap.cloud.sdk.services.anyofoneof.api;
+package test;
import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException;
import com.sap.cloud.sdk.services.openapi.core.OpenApiResponse;
import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService;
import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient;
-import com.sap.cloud.sdk.services.anyofoneof.model.RootObject;
+import test.OneOf;
import java.util.HashMap;
import java.util.List;
@@ -32,13 +32,13 @@
import com.sap.cloud.sdk.cloudplatform.connectivity.Destination;
/**
- * Sample API in version 1.0.0.
+ * Soda Store API in version 1.0.0.
*
- * API for managing root and child objects
+ * API for managing sodas in a soda store
*/
public class DefaultApi extends AbstractOpenApiService {
/**
- * Instantiates this API class to invoke operations on the Sample API.
+ * Instantiates this API class to invoke operations on the Soda Store API.
*
* @param httpDestination The destination that API should be used with
*/
@@ -48,7 +48,7 @@ public DefaultApi( @Nonnull final Destination httpDestination )
}
/**
- * Instantiates this API class to invoke operations on the Sample API based on a given {@link ApiClient}.
+ * Instantiates this API class to invoke operations on the Soda Store API based on a given {@link ApiClient}.
*
* @param apiClient
* ApiClient to invoke the API on
@@ -59,23 +59,18 @@ public DefaultApi( @Nonnull final ApiClient apiClient )
super(apiClient);
}
-
- /**
+ /**
+ * Get a list of all sodas
*
- *
- * 201 - Something was created.
- *
400 - Request was invalid.
- *
401 - Authentication Error
- * @param rootObject (optional)
- The value for the parameter rootObject
- * @return RootObject
+ *
200 - A list of sodas
+ * @return List<OneOf>
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
*/
@Nonnull
- public RootObject someEndpointPost( @Nullable final RootObject rootObject) throws OpenApiRequestException {
- final Object localVarPostBody = rootObject;
+ public List getSodas() throws OpenApiRequestException {
+ final Object localVarPostBody = null;
- final String localVarPath = UriComponentsBuilder.fromPath("/some/endpoint").build().toUriString();
+ final String localVarPath = UriComponentsBuilder.fromPath("/sodas").build().toUriString();
final MultiValueMap localVarQueryParams = new LinkedMultiValueMap();
final HttpHeaders localVarHeaderParams = new HttpHeaders();
@@ -85,28 +80,12 @@ public RootObject someEndpointPost( @Nullable final RootObject rootObject) throw
"application/json"
};
final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
- final String[] localVarContentTypes = {
- "application/json"
- };
+ final String[] localVarContentTypes = { };
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
final String[] localVarAuthNames = new String[] { };
- final ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
- return apiClient.invokeAPI(localVarPath, HttpMethod.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
- }
-
- /**
- *
- *
- * 201 - Something was created.
- *
400 - Request was invalid.
- *
401 - Authentication Error
- * @return RootObject
- * @throws OpenApiRequestException if an error occurs while attempting to invoke the API
- */
- @Nonnull
- public RootObject someEndpointPost() throws OpenApiRequestException {
- return someEndpointPost(null);
+ final ParameterizedTypeReference> localVarReturnType = new ParameterizedTypeReference>() {};
+ return apiClient.invokeAPI(localVarPath, HttpMethod.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/Fanta.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/Fanta.java
new file mode 100644
index 000000000..c6359bba1
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/Fanta.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * Fanta
+ */
+// CHECKSTYLE:OFF
+public class Fanta
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link Fanta} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link Fanta}
+ * @return The same instance of this {@link Fanta} class
+ */
+ @Nonnull public Fanta sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link Fanta} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link Fanta} instance.
+ *
+ * @param sodaType The sodaType of this {@link Fanta}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link Fanta}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link Fanta} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("Fanta has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link Fanta} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final Fanta fanta = (Fanta) o;
+ return Objects.equals(this.cloudSdkCustomFields, fanta.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, fanta.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class Fanta {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/OneOf.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/OneOf.java
new file mode 100644
index 000000000..7ad1e3e0a
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/OneOf.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import test.Cola;
+import test.Fanta;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * OneOf
+ */
+// CHECKSTYLE:OFF
+public class OneOf
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link OneOf} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link OneOf}
+ * @return The same instance of this {@link OneOf} class
+ */
+ @Nonnull public OneOf sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link OneOf} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link OneOf} instance.
+ *
+ * @param sodaType The sodaType of this {@link OneOf}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link OneOf}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link OneOf} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("OneOf has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link OneOf} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final OneOf oneOf = (OneOf) o;
+ return Objects.equals(this.cloudSdkCustomFields, oneOf.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, oneOf.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class OneOf {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/OneOfWithDiscriminator.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/OneOfWithDiscriminator.java
new file mode 100644
index 000000000..9a17581c0
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/OneOfWithDiscriminator.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import test.Cola;
+import test.Fanta;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * OneOfWithDiscriminator
+ */
+
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "sodaType", visible = true)
+@JsonSubTypes({
+ @JsonSubTypes.Type(value = Cola.class, name = "Cola"),
+ @JsonSubTypes.Type(value = Fanta.class, name = "Fanta"),
+})
+// CHECKSTYLE:OFF
+public class OneOfWithDiscriminator
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link OneOfWithDiscriminator} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link OneOfWithDiscriminator}
+ * @return The same instance of this {@link OneOfWithDiscriminator} class
+ */
+ @Nonnull public OneOfWithDiscriminator sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link OneOfWithDiscriminator} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link OneOfWithDiscriminator} instance.
+ *
+ * @param sodaType The sodaType of this {@link OneOfWithDiscriminator}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link OneOfWithDiscriminator}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link OneOfWithDiscriminator} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("OneOfWithDiscriminator has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link OneOfWithDiscriminator} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final OneOfWithDiscriminator oneOfWithDiscriminator = (OneOfWithDiscriminator) o;
+ return Objects.equals(this.cloudSdkCustomFields, oneOfWithDiscriminator.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, oneOfWithDiscriminator.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class OneOfWithDiscriminator {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/OneOfWithDiscriminatorAndMapping.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/OneOfWithDiscriminatorAndMapping.java
new file mode 100644
index 000000000..37a3763f4
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-disabled/output/test/OneOfWithDiscriminatorAndMapping.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import test.Cola;
+import test.Fanta;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * OneOfWithDiscriminatorAndMapping
+ */
+
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "sodaType", visible = true)
+@JsonSubTypes({
+ @JsonSubTypes.Type(value = Cola.class, name = "Cola"),
+ @JsonSubTypes.Type(value = Fanta.class, name = "Fanta"),
+})
+// CHECKSTYLE:OFF
+public class OneOfWithDiscriminatorAndMapping
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link OneOfWithDiscriminatorAndMapping} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link OneOfWithDiscriminatorAndMapping}
+ * @return The same instance of this {@link OneOfWithDiscriminatorAndMapping} class
+ */
+ @Nonnull public OneOfWithDiscriminatorAndMapping sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link OneOfWithDiscriminatorAndMapping} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link OneOfWithDiscriminatorAndMapping} instance.
+ *
+ * @param sodaType The sodaType of this {@link OneOfWithDiscriminatorAndMapping}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link OneOfWithDiscriminatorAndMapping}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link OneOfWithDiscriminatorAndMapping} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("OneOfWithDiscriminatorAndMapping has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link OneOfWithDiscriminatorAndMapping} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final OneOfWithDiscriminatorAndMapping oneOfWithDiscriminatorAndMapping = (OneOfWithDiscriminatorAndMapping) o;
+ return Objects.equals(this.cloudSdkCustomFields, oneOfWithDiscriminatorAndMapping.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, oneOfWithDiscriminatorAndMapping.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class OneOfWithDiscriminatorAndMapping {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/input/sodastore.yaml b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/input/sodastore.yaml
new file mode 100644
index 000000000..470276795
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/input/sodastore.yaml
@@ -0,0 +1,58 @@
+openapi: 3.0.0
+info:
+ title: Soda Store API
+ version: 1.0.0
+ description: API for managing sodas in a soda store
+paths:
+ /sodas:
+ get:
+ summary: Get a list of all sodas
+ operationId: getSodas
+ responses:
+ '200':
+ description: A list of sodas
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/OneOf'
+components:
+ schemas:
+ OneOfWithDiscriminatorAndMapping:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ discriminator:
+ propertyName: sodaType
+ mapping:
+ Cola: '#/components/schemas/Cola'
+ Fanta: '#/components/schemas/Fanta'
+ OneOfWithDiscriminator:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ discriminator:
+ propertyName: sodaType
+ OneOf:
+ oneOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ AnyOf:
+ anyOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ AllOf:
+ allOf:
+ - $ref: '#/components/schemas/Cola'
+ - $ref: '#/components/schemas/Fanta'
+ Cola:
+ type: object
+ properties:
+ sodaType:
+ type: string
+ Fanta:
+ type: object
+ properties:
+ sodaType:
+ type: string
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/AllOf.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/AllOf.java
new file mode 100644
index 000000000..a2c60509f
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/AllOf.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * AllOf
+ */
+// CHECKSTYLE:OFF
+public class AllOf
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link AllOf} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link AllOf}
+ * @return The same instance of this {@link AllOf} class
+ */
+ @Nonnull public AllOf sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link AllOf} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link AllOf} instance.
+ *
+ * @param sodaType The sodaType of this {@link AllOf}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link AllOf}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link AllOf} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("AllOf has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link AllOf} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final AllOf allOf = (AllOf) o;
+ return Objects.equals(this.cloudSdkCustomFields, allOf.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, allOf.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AllOf {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/AnyOf.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/AnyOf.java
new file mode 100644
index 000000000..879569438
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/AnyOf.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import test.Cola;
+import test.Fanta;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * AnyOf
+ */
+// CHECKSTYLE:OFF
+public class AnyOf
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link AnyOf} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link AnyOf}
+ * @return The same instance of this {@link AnyOf} class
+ */
+ @Nonnull public AnyOf sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link AnyOf} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link AnyOf} instance.
+ *
+ * @param sodaType The sodaType of this {@link AnyOf}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link AnyOf}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link AnyOf} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("AnyOf has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link AnyOf} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final AnyOf anyOf = (AnyOf) o;
+ return Objects.equals(this.cloudSdkCustomFields, anyOf.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, anyOf.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AnyOf {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/Cola.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/Cola.java
new file mode 100644
index 000000000..3f3063d9d
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/Cola.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * Cola
+ */
+// CHECKSTYLE:OFF
+public class Cola implements OneOf, OneOfWithDiscriminator, OneOfWithDiscriminatorAndMapping
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link Cola} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link Cola}
+ * @return The same instance of this {@link Cola} class
+ */
+ @Nonnull public Cola sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link Cola} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link Cola} instance.
+ *
+ * @param sodaType The sodaType of this {@link Cola}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link Cola}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link Cola} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("Cola has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link Cola} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final Cola cola = (Cola) o;
+ return Objects.equals(this.cloudSdkCustomFields, cola.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, cola.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class Cola {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/DefaultApi.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/DefaultApi.java
new file mode 100644
index 000000000..424ff2c43
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/DefaultApi.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+package test;
+
+import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException;
+import com.sap.cloud.sdk.services.openapi.core.OpenApiResponse;
+import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService;
+import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient;
+
+import test.OneOf;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.util.UriComponentsBuilder;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import com.google.common.annotations.Beta;
+
+import com.sap.cloud.sdk.cloudplatform.connectivity.Destination;
+
+/**
+ * Soda Store API in version 1.0.0.
+ *
+ * API for managing sodas in a soda store
+ */
+public class DefaultApi extends AbstractOpenApiService {
+ /**
+ * Instantiates this API class to invoke operations on the Soda Store API.
+ *
+ * @param httpDestination The destination that API should be used with
+ */
+ public DefaultApi( @Nonnull final Destination httpDestination )
+ {
+ super(httpDestination);
+ }
+
+ /**
+ * Instantiates this API class to invoke operations on the Soda Store API based on a given {@link ApiClient}.
+ *
+ * @param apiClient
+ * ApiClient to invoke the API on
+ */
+ @Beta
+ public DefaultApi( @Nonnull final ApiClient apiClient )
+ {
+ super(apiClient);
+ }
+
+ /**
+ * Get a list of all sodas
+ *
+ * 200 - A list of sodas
+ * @return List<OneOf>
+ * @throws OpenApiRequestException if an error occurs while attempting to invoke the API
+ */
+ @Nonnull
+ public List getSodas() throws OpenApiRequestException {
+ final Object localVarPostBody = null;
+
+ final String localVarPath = UriComponentsBuilder.fromPath("/sodas").build().toUriString();
+
+ final MultiValueMap localVarQueryParams = new LinkedMultiValueMap();
+ final HttpHeaders localVarHeaderParams = new HttpHeaders();
+ final MultiValueMap localVarFormParams = new LinkedMultiValueMap();
+
+ final String[] localVarAccepts = {
+ "application/json"
+ };
+ final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
+ final String[] localVarContentTypes = { };
+ final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+
+ final String[] localVarAuthNames = new String[] { };
+
+ final ParameterizedTypeReference> localVarReturnType = new ParameterizedTypeReference>() {};
+ return apiClient.invokeAPI(localVarPath, HttpMethod.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
+ }
+}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/Fanta.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/Fanta.java
new file mode 100644
index 000000000..4ec3ade18
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/Fanta.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * Fanta
+ */
+// CHECKSTYLE:OFF
+public class Fanta implements OneOf, OneOfWithDiscriminator, OneOfWithDiscriminatorAndMapping
+// CHECKSTYLE:ON
+{
+ @JsonProperty("sodaType")
+ private String sodaType;
+
+ @JsonAnySetter
+ @JsonAnyGetter
+ private final Map cloudSdkCustomFields = new LinkedHashMap<>();
+
+ /**
+ * Set the sodaType of this {@link Fanta} instance and return the same instance.
+ *
+ * @param sodaType The sodaType of this {@link Fanta}
+ * @return The same instance of this {@link Fanta} class
+ */
+ @Nonnull public Fanta sodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ return this;
+ }
+
+ /**
+ * Get sodaType
+ * @return sodaType The sodaType of this {@link Fanta} instance.
+ */
+ @Nonnull
+ public String getSodaType() {
+ return sodaType;
+ }
+
+ /**
+ * Set the sodaType of this {@link Fanta} instance.
+ *
+ * @param sodaType The sodaType of this {@link Fanta}
+ */
+ public void setSodaType( @Nullable final String sodaType) {
+ this.sodaType = sodaType;
+ }
+
+ /**
+ * Get the names of the unrecognizable properties of the {@link Fanta}.
+ * @return The set of properties names
+ */
+ @JsonIgnore
+ @Nonnull
+ public Set getCustomFieldNames() {
+ return cloudSdkCustomFields.keySet();
+ }
+
+ /**
+ * Get the value of an unrecognizable property of this {@link Fanta} instance.
+ * @param name The name of the property
+ * @return The value of the property
+ * @throws NoSuchElementException If no property with the given name could be found.
+ */
+ @Nullable
+ public Object getCustomField( @Nonnull final String name ) throws NoSuchElementException {
+ if( !cloudSdkCustomFields.containsKey(name) ) {
+ throw new NoSuchElementException("Fanta has no field with name '" + name + "'.");
+ }
+ return cloudSdkCustomFields.get(name);
+ }
+
+ /**
+ * Set an unrecognizable property of this {@link Fanta} instance. If the map previously contained a mapping
+ * for the key, the old value is replaced by the specified value.
+ * @param customFieldName The name of the property
+ * @param customFieldValue The value of the property
+ */
+ @JsonIgnore
+ public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue )
+ {
+ cloudSdkCustomFields.put(customFieldName, customFieldValue);
+ }
+
+
+ @Override
+ public boolean equals(@Nullable final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final Fanta fanta = (Fanta) o;
+ return Objects.equals(this.cloudSdkCustomFields, fanta.cloudSdkCustomFields) &&
+ Objects.equals(this.sodaType, fanta.sodaType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sodaType, cloudSdkCustomFields);
+ }
+
+ @Override
+ @Nonnull public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class Fanta {\n");
+ sb.append(" sodaType: ").append(toIndentedString(sodaType)).append("\n");
+ cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/OneOf.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/OneOf.java
new file mode 100644
index 000000000..585bb03e6
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/OneOf.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import test.Cola;
+import test.Fanta;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * OneOf
+ */
+
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "", visible = true)
+
+public interface OneOf {
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/OneOfWithDiscriminator.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/OneOfWithDiscriminator.java
new file mode 100644
index 000000000..c0769d357
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/OneOfWithDiscriminator.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import test.Cola;
+import test.Fanta;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * OneOfWithDiscriminator
+ */
+
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "sodaType", visible = true)
+@JsonSubTypes({
+ @JsonSubTypes.Type(value = Cola.class, name = "Cola"),
+ @JsonSubTypes.Type(value = Fanta.class, name = "Fanta"),
+})
+
+public interface OneOfWithDiscriminator {
+ public String getSodaType();
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/OneOfWithDiscriminatorAndMapping.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/OneOfWithDiscriminatorAndMapping.java
new file mode 100644
index 000000000..8fa693365
--- /dev/null
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/oneof-interfaces-enabled/output/test/OneOfWithDiscriminatorAndMapping.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
+ */
+
+/*
+ * Soda Store API
+ * API for managing sodas in a soda store
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package test;
+
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import test.Cola;
+import test.Fanta;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * OneOfWithDiscriminatorAndMapping
+ */
+
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "sodaType", visible = true)
+@JsonSubTypes({
+ @JsonSubTypes.Type(value = Cola.class, name = "Cola"),
+ @JsonSubTypes.Type(value = Fanta.class, name = "Fanta"),
+})
+
+public interface OneOfWithDiscriminatorAndMapping {
+ public String getSodaType();
+}
+
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Order.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Order.java
index 0e4668789..61892d351 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Order.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Order.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.builder.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -78,7 +76,8 @@ public class Order
* Get productId
* @return productId The productId of this {@link Order} instance.
*/
- @Nonnull public Long getProductId() {
+ @Nonnull
+ public Long getProductId() {
return productId;
}
@@ -106,7 +105,8 @@ public void setProductId( @Nonnull final Long productId) {
* Get quantity
* @return quantity The quantity of this {@link Order} instance.
*/
- @Nonnull public Integer getQuantity() {
+ @Nonnull
+ public Integer getQuantity() {
return quantity;
}
@@ -134,7 +134,8 @@ public void setQuantity( @Nonnull final Integer quantity) {
* Get totalPrice
* @return totalPrice The totalPrice of this {@link Order} instance.
*/
- @Nonnull public Float getTotalPrice() {
+ @Nonnull
+ public Float getTotalPrice() {
return totalPrice;
}
@@ -162,7 +163,8 @@ public void setTotalPrice( @Nullable final Float totalPrice) {
* Some typeless property, interpreted by the generator as nullable by default (because typeless)
* @return typelessProperty The typelessProperty of this {@link Order} instance.
*/
- @Nullable public Object getTypelessProperty() {
+ @Nullable
+ public Object getTypelessProperty() {
return typelessProperty;
}
@@ -190,7 +192,8 @@ public void setTypelessProperty( @Nullable final Object typelessProperty) {
* Some typed property that is deliberately made nullable
* @return nullableProperty The nullableProperty of this {@link Order} instance.
*/
- @Nullable public String getNullableProperty() {
+ @Nullable
+ public String getNullableProperty() {
return nullableProperty;
}
@@ -287,6 +290,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/OrderWithTimestamp.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/OrderWithTimestamp.java
index 9375480e4..90068f114 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/OrderWithTimestamp.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/OrderWithTimestamp.java
@@ -16,11 +16,11 @@
package com.sap.cloud.sdk.services.builder.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -28,12 +28,10 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -82,7 +80,8 @@ public class OrderWithTimestamp
* Get productId
* @return productId The productId of this {@link OrderWithTimestamp} instance.
*/
- @Nonnull public Long getProductId() {
+ @Nonnull
+ public Long getProductId() {
return productId;
}
@@ -110,7 +109,8 @@ public void setProductId( @Nonnull final Long productId) {
* Get quantity
* @return quantity The quantity of this {@link OrderWithTimestamp} instance.
*/
- @Nonnull public Integer getQuantity() {
+ @Nonnull
+ public Integer getQuantity() {
return quantity;
}
@@ -138,7 +138,8 @@ public void setQuantity( @Nonnull final Integer quantity) {
* Get totalPrice
* @return totalPrice The totalPrice of this {@link OrderWithTimestamp} instance.
*/
- @Nonnull public Float getTotalPrice() {
+ @Nonnull
+ public Float getTotalPrice() {
return totalPrice;
}
@@ -166,7 +167,8 @@ public void setTotalPrice( @Nullable final Float totalPrice) {
* Some typeless property, interpreted by the generator as nullable by default (because typeless)
* @return typelessProperty The typelessProperty of this {@link OrderWithTimestamp} instance.
*/
- @Nullable public Object getTypelessProperty() {
+ @Nullable
+ public Object getTypelessProperty() {
return typelessProperty;
}
@@ -194,7 +196,8 @@ public void setTypelessProperty( @Nullable final Object typelessProperty) {
* Some typed property that is deliberately made nullable
* @return nullableProperty The nullableProperty of this {@link OrderWithTimestamp} instance.
*/
- @Nullable public String getNullableProperty() {
+ @Nullable
+ public String getNullableProperty() {
return nullableProperty;
}
@@ -222,7 +225,8 @@ public void setNullableProperty( @Nullable final String nullableProperty) {
* Get timestamp
* @return timestamp The timestamp of this {@link OrderWithTimestamp} instance.
*/
- @Nonnull public OffsetDateTime getTimestamp() {
+ @Nonnull
+ public OffsetDateTime getTimestamp() {
return timestamp;
}
@@ -321,6 +325,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Soda.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Soda.java
index f481a6be7..897c194df 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Soda.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/Soda.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.builder.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -137,7 +135,8 @@ public enum PackagingEnum {
* Get name
* @return name The name of this {@link Soda} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -165,7 +164,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link Soda} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -193,7 +193,8 @@ public void setBrand( @Nonnull final String brand) {
* Get quantity
* @return quantity The quantity of this {@link Soda} instance.
*/
- @Nonnull public Integer getQuantity() {
+ @Nonnull
+ public Integer getQuantity() {
return quantity;
}
@@ -221,7 +222,8 @@ public void setQuantity( @Nonnull final Integer quantity) {
* Get packaging
* @return packaging The packaging of this {@link Soda} instance.
*/
- @Nonnull public PackagingEnum getPackaging() {
+ @Nonnull
+ public PackagingEnum getPackaging() {
return packaging;
}
@@ -249,7 +251,8 @@ public void setPackaging( @Nullable final PackagingEnum packaging) {
* Get price
* @return price The price of this {@link Soda} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -346,6 +349,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/SodaWithId.java b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/SodaWithId.java
index 81f4ec42c..ec29ae38f 100644
--- a/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/SodaWithId.java
+++ b/datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/remove-operation-id-prefix/output/com/sap/cloud/sdk/services/builder/model/SodaWithId.java
@@ -16,23 +16,21 @@
package com.sap.cloud.sdk.services.builder.model;
+import java.util.Objects;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -140,7 +138,8 @@ public enum PackagingEnum {
* Get name
* @return name The name of this {@link SodaWithId} instance.
*/
- @Nonnull public String getName() {
+ @Nonnull
+ public String getName() {
return name;
}
@@ -168,7 +167,8 @@ public void setName( @Nonnull final String name) {
* Get brand
* @return brand The brand of this {@link SodaWithId} instance.
*/
- @Nonnull public String getBrand() {
+ @Nonnull
+ public String getBrand() {
return brand;
}
@@ -196,7 +196,8 @@ public void setBrand( @Nonnull final String brand) {
* Get quantity
* @return quantity The quantity of this {@link SodaWithId} instance.
*/
- @Nonnull public Integer getQuantity() {
+ @Nonnull
+ public Integer getQuantity() {
return quantity;
}
@@ -224,7 +225,8 @@ public void setQuantity( @Nonnull final Integer quantity) {
* Get packaging
* @return packaging The packaging of this {@link SodaWithId} instance.
*/
- @Nonnull public PackagingEnum getPackaging() {
+ @Nonnull
+ public PackagingEnum getPackaging() {
return packaging;
}
@@ -252,7 +254,8 @@ public void setPackaging( @Nullable final PackagingEnum packaging) {
* Get price
* @return price The price of this {@link SodaWithId} instance.
*/
- @Nonnull public Float getPrice() {
+ @Nonnull
+ public Float getPrice() {
return price;
}
@@ -280,7 +283,8 @@ public void setPrice( @Nonnull final Float price) {
* Get id
* @return id The id of this {@link SodaWithId} instance.
*/
- @Nonnull public Long getId() {
+ @Nonnull
+ public Long getId() {
return id;
}
@@ -379,6 +383,5 @@ private String toIndentedString(final java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
-
}
diff --git a/release_notes.md b/release_notes.md
index e56132fa5..31efa2a95 100644
--- a/release_notes.md
+++ b/release_notes.md
@@ -13,6 +13,8 @@
### ✨ New Functionality
- Add support for `TypeDefinition` entries in OData V4 EDMX files.
+- Add `generateApis` and `generateModels` options to the `openapi-generator-maven-plugin` to
+ disable the generation of APIs and models respectively.
### 📈 Improvements