mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 21:06:11 +00:00
[Feature][Java/Spring] Support Discriminator Based OneOf Interface (#11650)
* Fix OpenAPITools#5381 added x-is-one-of-interface extension for oneOf interface in mustache template * Fix OpenAPITools#5381 fixed name of model from UNKNOWN_BASE_TYPE to right one in api: operationId + OneOf Fix OpenAPITools#5381 parcelableModel is not required * Fix OpenAPITools#5381 removed not needed methods * Fix OpenAPITools#5381 catch NPE cases in preprocessOpenAPI updated samples * Fix OpenAPITools#5381 fixed generation of oneOf Models * Fix OpenAPITools#5381 addOneOfInterfaceModel only for cases when useOneOfInterfaces is true and for spring * Fix OpenAPITools#5381 NPE fix * Fix OpenAPITools#5381 spring: fixed use of oneOf Models in API * Fix OpenAPITools#5381 implementing oneOf for spring lib overriding methods with different behavior from default * Fix OpenAPITools#5381 added x-is-one-of-interface extension for oneOf interface in mustache template * Fix OpenAPITools#5381 fixed name of model from UNKNOWN_BASE_TYPE to right one in api: operationId + OneOf Fix OpenAPITools#5381 removed not needed methods Fix OpenAPITools#5381 fixed generation of oneOf Models Fix OpenAPITools#5381 addOneOfInterfaceModel only for cases when useOneOfInterfaces is true and for spring Fix OpenAPITools#5381 NPE fix for tests * Fix OpenAPITools#5381 fixed handing of composed schema with array * Fix OpenAPITools#5381 fixed NPE in addOneOfInterfaceModel * Fix OpenAPITools#5381 fixed generation of oneOf models with descriminator * Initial merge of 5.0 * Aligned with master formatting * Corrected spacing for class names to align with samples. * Merged master * Updated samples * Consolidate methods from JavaClient and SpringCodegen (mov up to AbstractJavaCodegen) * set useLegacyDiscriminator to false, format templates * Suport JsonTypeName, fq class name for spring.io.Resource * Generate Samples * Test full qualified usage of the spring Resource interface. * Add java-camel to samples.circleci.spring profile * Add more complex example combining inheritance and oneof-interface * Remove x-implements Serializable from JavaClientCodegen (moved to AbstractJavaCodegen) * Fix spacing before opening brace after extends/implements * Generate Samples * Add more complex example combining inheritance and oneof-interface * Generate Samples * Fix JsonTypeName annotation handling in Java and JavaSpring * Content mediatype is hardcoded in api.mustache #11511 * Generate Samples * OAS3 incorrect data type when providing a default value #11367 * Generate Samples * Fix JsonTypeName annotation handling in Java and JavaSpring * Generate Samples * getIsClassnameSanitized: use null safe equals * Fix JsonTypeName annotation handling in Java and JavaSpring (merge) * Generate Samples * Generate Samples * Add oneof sample * Generate Samples * Giv example oas spec a meaningful name, demo usage of oneOf in Model * Generate Samples * Remove unnecessary JsonTypeName include, add example for JsonTypeName (Bar_Create) * Generate Samples * Generate Samples Co-authored-by: Alexej <oleksejk@gmail.com> Co-authored-by: JBurgess <joel.burgess@gmail.com> Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
@@ -20,7 +20,7 @@ import javax.annotation.Generated;
|
||||
|
||||
@Schema(name = "Category", description = "A category for a pet")
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
public class Category {
|
||||
public class Category {
|
||||
|
||||
@JsonProperty("id")
|
||||
private Long id;
|
||||
|
||||
@@ -22,7 +22,7 @@ import javax.annotation.Generated;
|
||||
@Schema(name = "ApiResponse", description = "Describes the result of uploading an image resource")
|
||||
@JsonTypeName("ApiResponse")
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
public class ModelApiResponse {
|
||||
public class ModelApiResponse {
|
||||
|
||||
@JsonProperty("code")
|
||||
private Integer code;
|
||||
|
||||
@@ -23,7 +23,7 @@ import javax.annotation.Generated;
|
||||
|
||||
@Schema(name = "Order", description = "An order for a pets from the pet store")
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
public class Order {
|
||||
public class Order {
|
||||
|
||||
@JsonProperty("id")
|
||||
private Long id;
|
||||
|
||||
@@ -25,7 +25,7 @@ import javax.annotation.Generated;
|
||||
|
||||
@Schema(name = "Pet", description = "A pet for sale in the pet store")
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
public class Pet {
|
||||
public class Pet {
|
||||
|
||||
@JsonProperty("id")
|
||||
private Long id;
|
||||
|
||||
@@ -20,7 +20,7 @@ import javax.annotation.Generated;
|
||||
|
||||
@Schema(name = "Tag", description = "A tag for a pet")
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
public class Tag {
|
||||
public class Tag {
|
||||
|
||||
@JsonProperty("id")
|
||||
private Long id;
|
||||
|
||||
@@ -20,7 +20,7 @@ import javax.annotation.Generated;
|
||||
|
||||
@Schema(name = "User", description = "A User who is purchasing from the pet store")
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
public class User {
|
||||
public class User {
|
||||
|
||||
@JsonProperty("id")
|
||||
private Long id;
|
||||
|
||||
Reference in New Issue
Block a user