[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:
cachescrubber
2022-03-16 15:50:05 +01:00
committed by GitHub
parent a3fb571a1b
commit e07c7d1617
1030 changed files with 4087 additions and 1027 deletions

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -0,0 +1,22 @@
README.md
pom.xml
src/main/java/org/openapitools/OpenApiGeneratorApplication.java
src/main/java/org/openapitools/RFC3339DateFormat.java
src/main/java/org/openapitools/api/ApiUtil.java
src/main/java/org/openapitools/api/BarApi.java
src/main/java/org/openapitools/api/BarApiController.java
src/main/java/org/openapitools/api/FooApi.java
src/main/java/org/openapitools/api/FooApiController.java
src/main/java/org/openapitools/configuration/HomeController.java
src/main/java/org/openapitools/model/Addressable.java
src/main/java/org/openapitools/model/Bar.java
src/main/java/org/openapitools/model/BarCreate.java
src/main/java/org/openapitools/model/Entity.java
src/main/java/org/openapitools/model/EntityRef.java
src/main/java/org/openapitools/model/Extensible.java
src/main/java/org/openapitools/model/Foo.java
src/main/java/org/openapitools/model/FooRef.java
src/main/java/org/openapitools/model/FooRefOrValue.java
src/main/resources/application.properties
src/main/resources/openapi.yaml
src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java

View File

@@ -0,0 +1 @@
6.0.0-SNAPSHOT

View File

@@ -0,0 +1,21 @@
# OpenAPI generated server
Spring Boot Server
## Overview
This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub.
This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework.
The underlying library integrating OpenAPI to Spring Boot is [springdoc](https://springdoc.org).
Springdoc will generate an OpenAPI v3 specification based on the generated Controller and Model classes.
The specification is available to download using the following url:
http://localhost:8080/v3/api-docs/
Start your server as a simple java application
You can view the api documentation in swagger-ui by pointing to
http://localhost:8080/swagger-ui.html
Change default port value in application.properties

View File

@@ -0,0 +1,78 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools.openapi3</groupId>
<artifactId>springboot-oneof</artifactId>
<packaging>jar</packaging>
<name>springboot-oneof</name>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<springdoc.version>1.6.4</springdoc.version>
<swagger-ui.version>4.4.1-1</swagger-ui.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
</parent>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<!--SpringDoc dependencies -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<!-- @Nullable annotation -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.2</version>
</dependency>
<!-- Bean Validation API support -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,23 @@
package org.openapitools;
import com.fasterxml.jackson.databind.Module;
import org.openapitools.jackson.nullable.JsonNullableModule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"})
public class OpenApiGeneratorApplication {
public static void main(String[] args) {
SpringApplication.run(OpenApiGeneratorApplication.class, args);
}
@Bean
public Module jsonNullableModule() {
return new JsonNullableModule();
}
}

View File

@@ -0,0 +1,38 @@
package org.openapitools;
import com.fasterxml.jackson.databind.util.StdDateFormat;
import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class RFC3339DateFormat extends DateFormat {
private static final long serialVersionUID = 1L;
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
private final StdDateFormat fmt = new StdDateFormat()
.withTimeZone(TIMEZONE_Z)
.withColonInTimeZone(true);
public RFC3339DateFormat() {
this.calendar = new GregorianCalendar();
}
@Override
public Date parse(String source, ParsePosition pos) {
return fmt.parse(source, pos);
}
@Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
return fmt.format(date, toAppendTo, fieldPosition);
}
@Override
public Object clone() {
return this;
}
}

View File

@@ -0,0 +1,19 @@
package org.openapitools.api;
import org.springframework.web.context.request.NativeWebRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class ApiUtil {
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
try {
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
res.setCharacterEncoding("UTF-8");
res.addHeader("Content-Type", contentType);
res.getWriter().print(example);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

View File

@@ -0,0 +1,80 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (6.0.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.openapitools.model.Bar;
import org.openapitools.model.BarCreate;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "bar", description = "the bar API")
public interface BarApi {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/**
* POST /bar : Create a Bar
*
* @param barCreate (required)
* @return Bar created (status code 200)
*/
@Operation(
operationId = "createBar",
summary = "Create a Bar",
tags = { "Bar" },
responses = {
@ApiResponse(responseCode = "200", description = "Bar created", content = {
@Content(mediaType = "application/json", schema = @Schema(implementation = Bar.class))
})
}
)
@RequestMapping(
method = RequestMethod.POST,
value = "/bar",
produces = { "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<Bar> createBar(
@Parameter(name = "BarCreate", description = "", required = true) @Valid @RequestBody BarCreate barCreate
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"id\" : \"id\", \"fooPropB\" : \"fooPropB\", \"barPropA\" : \"barPropA\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
}

View File

@@ -0,0 +1,47 @@
package org.openapitools.api;
import org.openapitools.model.Bar;
import org.openapitools.model.BarCreate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.context.request.NativeWebRequest;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller
@RequestMapping("${openapi.byRefOrValue.base-path:}")
public class BarApiController implements BarApi {
private final NativeWebRequest request;
@Autowired
public BarApiController(NativeWebRequest request) {
this.request = request;
}
@Override
public Optional<NativeWebRequest> getRequest() {
return Optional.ofNullable(request);
}
}

View File

@@ -0,0 +1,117 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (6.0.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api;
import org.openapitools.model.Foo;
import org.openapitools.model.FooRefOrValue;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "foo", description = "the foo API")
public interface FooApi {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/**
* POST /foo : Create a Foo
*
* @param foo The Foo to be created (optional)
* @return Error (status code 201)
*/
@Operation(
operationId = "createFoo",
summary = "Create a Foo",
tags = { "Foo" },
responses = {
@ApiResponse(responseCode = "201", description = "Error", content = {
@Content(mediaType = "application/json", schema = @Schema(implementation = FooRefOrValue.class))
})
}
)
@RequestMapping(
method = RequestMethod.POST,
value = "/foo",
produces = { "application/json" },
consumes = { "application/json;charset=utf-8" }
)
default ResponseEntity<FooRefOrValue> createFoo(
@Parameter(name = "Foo", description = "The Foo to be created") @Valid @RequestBody(required = false) Foo foo
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "null";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /foo : GET all Foos
*
* @return Success (status code 200)
*/
@Operation(
operationId = "getAllFoos",
summary = "GET all Foos",
tags = { "Foo" },
responses = {
@ApiResponse(responseCode = "200", description = "Success", content = {
@Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = FooRefOrValue.class))
})
}
)
@RequestMapping(
method = RequestMethod.GET,
value = "/foo",
produces = { "application/json;charset=utf-8" }
)
default ResponseEntity<List<FooRefOrValue>> getAllFoos(
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json;charset=utf-8"))) {
String exampleString = "null";
ApiUtil.setExampleResponse(request, "application/json;charset=utf-8", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
}

View File

@@ -0,0 +1,47 @@
package org.openapitools.api;
import org.openapitools.model.Foo;
import org.openapitools.model.FooRefOrValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.context.request.NativeWebRequest;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller
@RequestMapping("${openapi.byRefOrValue.base-path:}")
public class FooApiController implements FooApi {
private final NativeWebRequest request;
@Autowired
public FooApiController(NativeWebRequest request) {
this.request = request;
}
@Override
public Optional<NativeWebRequest> getRequest() {
return Optional.ofNullable(request);
}
}

View File

@@ -0,0 +1,20 @@
package org.openapitools.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.GetMapping;
/**
* Home redirection to OpenAPI api documentation
*/
@Controller
public class HomeController {
@RequestMapping("/")
public String index() {
return "redirect:swagger-ui.html";
}
}

View File

@@ -0,0 +1,108 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* Base schema for adressable entities
*/
@Schema(name = "Addressable", description = "Base schema for adressable entities")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Addressable {
@JsonProperty("href")
private String href;
@JsonProperty("id")
private String id;
public Addressable href(String href) {
this.href = href;
return this;
}
/**
* Hyperlink reference
* @return href
*/
@Schema(name = "href", description = "Hyperlink reference", required = false)
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public Addressable id(String id) {
this.id = id;
return this;
}
/**
* unique identifier
* @return id
*/
@Schema(name = "id", description = "unique identifier", required = false)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Addressable addressable = (Addressable) o;
return Objects.equals(this.href, addressable.href) &&
Objects.equals(this.id, addressable.id);
}
@Override
public int hashCode() {
return Objects.hash(href, id);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Addressable {\n");
sb.append(" href: ").append(toIndentedString(href)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,163 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 org.openapitools.model.Entity;
import org.openapitools.model.FooRefOrValue;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* Bar
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Bar extends Entity {
@JsonProperty("id")
private String id;
@JsonProperty("barPropA")
private String barPropA;
@JsonProperty("fooPropB")
private String fooPropB;
@JsonProperty("foo")
private FooRefOrValue foo;
public Bar id(String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@NotNull
@Schema(name = "id", required = true)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Bar barPropA(String barPropA) {
this.barPropA = barPropA;
return this;
}
/**
* Get barPropA
* @return barPropA
*/
@Schema(name = "barPropA", required = false)
public String getBarPropA() {
return barPropA;
}
public void setBarPropA(String barPropA) {
this.barPropA = barPropA;
}
public Bar fooPropB(String fooPropB) {
this.fooPropB = fooPropB;
return this;
}
/**
* Get fooPropB
* @return fooPropB
*/
@Schema(name = "fooPropB", required = false)
public String getFooPropB() {
return fooPropB;
}
public void setFooPropB(String fooPropB) {
this.fooPropB = fooPropB;
}
public Bar foo(FooRefOrValue foo) {
this.foo = foo;
return this;
}
/**
* Get foo
* @return foo
*/
@Valid
@Schema(name = "foo", required = false)
public FooRefOrValue getFoo() {
return foo;
}
public void setFoo(FooRefOrValue foo) {
this.foo = foo;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Bar bar = (Bar) o;
return Objects.equals(this.id, bar.id) &&
Objects.equals(this.barPropA, bar.barPropA) &&
Objects.equals(this.fooPropB, bar.fooPropB) &&
Objects.equals(this.foo, bar.foo) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(id, barPropA, fooPropB, foo, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Bar {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" barPropA: ").append(toIndentedString(barPropA)).append("\n");
sb.append(" fooPropB: ").append(toIndentedString(fooPropB)).append("\n");
sb.append(" foo: ").append(toIndentedString(foo)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,141 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 org.openapitools.model.Entity;
import org.openapitools.model.FooRefOrValue;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* BarCreate
*/
@JsonTypeName("Bar_Create")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class BarCreate extends Entity {
@JsonProperty("barPropA")
private String barPropA;
@JsonProperty("fooPropB")
private String fooPropB;
@JsonProperty("foo")
private FooRefOrValue foo;
public BarCreate barPropA(String barPropA) {
this.barPropA = barPropA;
return this;
}
/**
* Get barPropA
* @return barPropA
*/
@Schema(name = "barPropA", required = false)
public String getBarPropA() {
return barPropA;
}
public void setBarPropA(String barPropA) {
this.barPropA = barPropA;
}
public BarCreate fooPropB(String fooPropB) {
this.fooPropB = fooPropB;
return this;
}
/**
* Get fooPropB
* @return fooPropB
*/
@Schema(name = "fooPropB", required = false)
public String getFooPropB() {
return fooPropB;
}
public void setFooPropB(String fooPropB) {
this.fooPropB = fooPropB;
}
public BarCreate foo(FooRefOrValue foo) {
this.foo = foo;
return this;
}
/**
* Get foo
* @return foo
*/
@Valid
@Schema(name = "foo", required = false)
public FooRefOrValue getFoo() {
return foo;
}
public void setFoo(FooRefOrValue foo) {
this.foo = foo;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BarCreate barCreate = (BarCreate) o;
return Objects.equals(this.barPropA, barCreate.barPropA) &&
Objects.equals(this.fooPropB, barCreate.fooPropB) &&
Objects.equals(this.foo, barCreate.foo) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(barPropA, fooPropB, foo, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BarCreate {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" barPropA: ").append(toIndentedString(barPropA)).append("\n");
sb.append(" fooPropB: ").append(toIndentedString(fooPropB)).append("\n");
sb.append(" foo: ").append(toIndentedString(foo)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,198 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 org.openapitools.model.Addressable;
import org.openapitools.model.Bar;
import org.openapitools.model.BarCreate;
import org.openapitools.model.Extensible;
import org.openapitools.model.Foo;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* Entity
*/
@JsonIgnoreProperties(
value = "@type", // ignore manually set @type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the @type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Bar.class, name = "Bar"),
@JsonSubTypes.Type(value = BarCreate.class, name = "Bar_Create"),
@JsonSubTypes.Type(value = Foo.class, name = "Foo")
})
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Entity {
@JsonProperty("href")
private String href;
@JsonProperty("id")
private String id;
@JsonProperty("@schemaLocation")
private String atSchemaLocation;
@JsonProperty("@baseType")
private String atBaseType;
@JsonProperty("@type")
private String atType;
public Entity href(String href) {
this.href = href;
return this;
}
/**
* Hyperlink reference
* @return href
*/
@Schema(name = "href", description = "Hyperlink reference", required = false)
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public Entity id(String id) {
this.id = id;
return this;
}
/**
* unique identifier
* @return id
*/
@Schema(name = "id", description = "unique identifier", required = false)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Entity atSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
return this;
}
/**
* A URI to a JSON-Schema file that defines additional attributes and relationships
* @return atSchemaLocation
*/
@Schema(name = "@schemaLocation", description = "A URI to a JSON-Schema file that defines additional attributes and relationships", required = false)
public String getAtSchemaLocation() {
return atSchemaLocation;
}
public void setAtSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
}
public Entity atBaseType(String atBaseType) {
this.atBaseType = atBaseType;
return this;
}
/**
* When sub-classing, this defines the super-class
* @return atBaseType
*/
@Schema(name = "@baseType", description = "When sub-classing, this defines the super-class", required = false)
public String getAtBaseType() {
return atBaseType;
}
public void setAtBaseType(String atBaseType) {
this.atBaseType = atBaseType;
}
public Entity atType(String atType) {
this.atType = atType;
return this;
}
/**
* When sub-classing, this defines the sub-class Extensible name
* @return atType
*/
@NotNull
@Schema(name = "@type", description = "When sub-classing, this defines the sub-class Extensible name", required = true)
public String getAtType() {
return atType;
}
public void setAtType(String atType) {
this.atType = atType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Entity entity = (Entity) o;
return Objects.equals(this.href, entity.href) &&
Objects.equals(this.id, entity.id) &&
Objects.equals(this.atSchemaLocation, entity.atSchemaLocation) &&
Objects.equals(this.atBaseType, entity.atBaseType) &&
Objects.equals(this.atType, entity.atType);
}
@Override
public int hashCode() {
return Objects.hash(href, id, atSchemaLocation, atBaseType, atType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Entity {\n");
sb.append(" href: ").append(toIndentedString(href)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" atSchemaLocation: ").append(toIndentedString(atSchemaLocation)).append("\n");
sb.append(" atBaseType: ").append(toIndentedString(atBaseType)).append("\n");
sb.append(" atType: ").append(toIndentedString(atType)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,243 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 org.openapitools.model.Addressable;
import org.openapitools.model.Extensible;
import org.openapitools.model.FooRef;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* Entity reference schema to be use for all entityRef class.
*/
@Schema(name = "EntityRef", description = "Entity reference schema to be use for all entityRef class.")
@JsonIgnoreProperties(
value = "@type", // ignore manually set @type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the @type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = FooRef.class, name = "FooRef")
})
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class EntityRef {
@JsonProperty("name")
private String name;
@JsonProperty("@referredType")
private String atReferredType;
@JsonProperty("href")
private String href;
@JsonProperty("id")
private String id;
@JsonProperty("@schemaLocation")
private String atSchemaLocation;
@JsonProperty("@baseType")
private String atBaseType;
@JsonProperty("@type")
private String atType;
public EntityRef name(String name) {
this.name = name;
return this;
}
/**
* Name of the related entity.
* @return name
*/
@Schema(name = "name", description = "Name of the related entity.", required = false)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public EntityRef atReferredType(String atReferredType) {
this.atReferredType = atReferredType;
return this;
}
/**
* The actual type of the target instance when needed for disambiguation.
* @return atReferredType
*/
@Schema(name = "@referredType", description = "The actual type of the target instance when needed for disambiguation.", required = false)
public String getAtReferredType() {
return atReferredType;
}
public void setAtReferredType(String atReferredType) {
this.atReferredType = atReferredType;
}
public EntityRef href(String href) {
this.href = href;
return this;
}
/**
* Hyperlink reference
* @return href
*/
@Schema(name = "href", description = "Hyperlink reference", required = false)
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public EntityRef id(String id) {
this.id = id;
return this;
}
/**
* unique identifier
* @return id
*/
@Schema(name = "id", description = "unique identifier", required = false)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public EntityRef atSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
return this;
}
/**
* A URI to a JSON-Schema file that defines additional attributes and relationships
* @return atSchemaLocation
*/
@Schema(name = "@schemaLocation", description = "A URI to a JSON-Schema file that defines additional attributes and relationships", required = false)
public String getAtSchemaLocation() {
return atSchemaLocation;
}
public void setAtSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
}
public EntityRef atBaseType(String atBaseType) {
this.atBaseType = atBaseType;
return this;
}
/**
* When sub-classing, this defines the super-class
* @return atBaseType
*/
@Schema(name = "@baseType", description = "When sub-classing, this defines the super-class", required = false)
public String getAtBaseType() {
return atBaseType;
}
public void setAtBaseType(String atBaseType) {
this.atBaseType = atBaseType;
}
public EntityRef atType(String atType) {
this.atType = atType;
return this;
}
/**
* When sub-classing, this defines the sub-class Extensible name
* @return atType
*/
@NotNull
@Schema(name = "@type", description = "When sub-classing, this defines the sub-class Extensible name", required = true)
public String getAtType() {
return atType;
}
public void setAtType(String atType) {
this.atType = atType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EntityRef entityRef = (EntityRef) o;
return Objects.equals(this.name, entityRef.name) &&
Objects.equals(this.atReferredType, entityRef.atReferredType) &&
Objects.equals(this.href, entityRef.href) &&
Objects.equals(this.id, entityRef.id) &&
Objects.equals(this.atSchemaLocation, entityRef.atSchemaLocation) &&
Objects.equals(this.atBaseType, entityRef.atBaseType) &&
Objects.equals(this.atType, entityRef.atType);
}
@Override
public int hashCode() {
return Objects.hash(name, atReferredType, href, id, atSchemaLocation, atBaseType, atType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class EntityRef {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" atReferredType: ").append(toIndentedString(atReferredType)).append("\n");
sb.append(" href: ").append(toIndentedString(href)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" atSchemaLocation: ").append(toIndentedString(atSchemaLocation)).append("\n");
sb.append(" atBaseType: ").append(toIndentedString(atBaseType)).append("\n");
sb.append(" atType: ").append(toIndentedString(atType)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,131 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* Extensible
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Extensible {
@JsonProperty("@schemaLocation")
private String atSchemaLocation;
@JsonProperty("@baseType")
private String atBaseType;
@JsonProperty("@type")
private String atType;
public Extensible atSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
return this;
}
/**
* A URI to a JSON-Schema file that defines additional attributes and relationships
* @return atSchemaLocation
*/
@Schema(name = "@schemaLocation", description = "A URI to a JSON-Schema file that defines additional attributes and relationships", required = false)
public String getAtSchemaLocation() {
return atSchemaLocation;
}
public void setAtSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
}
public Extensible atBaseType(String atBaseType) {
this.atBaseType = atBaseType;
return this;
}
/**
* When sub-classing, this defines the super-class
* @return atBaseType
*/
@Schema(name = "@baseType", description = "When sub-classing, this defines the super-class", required = false)
public String getAtBaseType() {
return atBaseType;
}
public void setAtBaseType(String atBaseType) {
this.atBaseType = atBaseType;
}
public Extensible atType(String atType) {
this.atType = atType;
return this;
}
/**
* When sub-classing, this defines the sub-class Extensible name
* @return atType
*/
@NotNull
@Schema(name = "@type", description = "When sub-classing, this defines the sub-class Extensible name", required = true)
public String getAtType() {
return atType;
}
public void setAtType(String atType) {
this.atType = atType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Extensible extensible = (Extensible) o;
return Objects.equals(this.atSchemaLocation, extensible.atSchemaLocation) &&
Objects.equals(this.atBaseType, extensible.atBaseType) &&
Objects.equals(this.atType, extensible.atType);
}
@Override
public int hashCode() {
return Objects.hash(atSchemaLocation, atBaseType, atType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Extensible {\n");
sb.append(" atSchemaLocation: ").append(toIndentedString(atSchemaLocation)).append("\n");
sb.append(" atBaseType: ").append(toIndentedString(atBaseType)).append("\n");
sb.append(" atType: ").append(toIndentedString(atType)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,234 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 org.openapitools.model.Entity;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* Foo
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Foo extends Entity implements FooRefOrValue {
@JsonProperty("fooPropA")
private String fooPropA;
@JsonProperty("fooPropB")
private String fooPropB;
@JsonProperty("href")
private String href;
@JsonProperty("id")
private String id;
@JsonProperty("@schemaLocation")
private String atSchemaLocation;
@JsonProperty("@baseType")
private String atBaseType;
@JsonProperty("@type")
private String atType;
public Foo fooPropA(String fooPropA) {
this.fooPropA = fooPropA;
return this;
}
/**
* Get fooPropA
* @return fooPropA
*/
@Schema(name = "fooPropA", required = false)
public String getFooPropA() {
return fooPropA;
}
public void setFooPropA(String fooPropA) {
this.fooPropA = fooPropA;
}
public Foo fooPropB(String fooPropB) {
this.fooPropB = fooPropB;
return this;
}
/**
* Get fooPropB
* @return fooPropB
*/
@Schema(name = "fooPropB", required = false)
public String getFooPropB() {
return fooPropB;
}
public void setFooPropB(String fooPropB) {
this.fooPropB = fooPropB;
}
public Foo href(String href) {
this.href = href;
return this;
}
/**
* Hyperlink reference
* @return href
*/
@Schema(name = "href", description = "Hyperlink reference", required = false)
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public Foo id(String id) {
this.id = id;
return this;
}
/**
* unique identifier
* @return id
*/
@Schema(name = "id", description = "unique identifier", required = false)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Foo atSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
return this;
}
/**
* A URI to a JSON-Schema file that defines additional attributes and relationships
* @return atSchemaLocation
*/
@Schema(name = "@schemaLocation", description = "A URI to a JSON-Schema file that defines additional attributes and relationships", required = false)
public String getAtSchemaLocation() {
return atSchemaLocation;
}
public void setAtSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
}
public Foo atBaseType(String atBaseType) {
this.atBaseType = atBaseType;
return this;
}
/**
* When sub-classing, this defines the super-class
* @return atBaseType
*/
@Schema(name = "@baseType", description = "When sub-classing, this defines the super-class", required = false)
public String getAtBaseType() {
return atBaseType;
}
public void setAtBaseType(String atBaseType) {
this.atBaseType = atBaseType;
}
public Foo atType(String atType) {
this.atType = atType;
return this;
}
/**
* When sub-classing, this defines the sub-class Extensible name
* @return atType
*/
@NotNull
@Schema(name = "@type", description = "When sub-classing, this defines the sub-class Extensible name", required = true)
public String getAtType() {
return atType;
}
public void setAtType(String atType) {
this.atType = atType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Foo foo = (Foo) o;
return Objects.equals(this.fooPropA, foo.fooPropA) &&
Objects.equals(this.fooPropB, foo.fooPropB) &&
Objects.equals(this.href, foo.href) &&
Objects.equals(this.id, foo.id) &&
Objects.equals(this.atSchemaLocation, foo.atSchemaLocation) &&
Objects.equals(this.atBaseType, foo.atBaseType) &&
Objects.equals(this.atType, foo.atType) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(fooPropA, fooPropB, href, id, atSchemaLocation, atBaseType, atType, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Foo {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" fooPropA: ").append(toIndentedString(fooPropA)).append("\n");
sb.append(" fooPropB: ").append(toIndentedString(fooPropB)).append("\n");
sb.append(" href: ").append(toIndentedString(href)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" atSchemaLocation: ").append(toIndentedString(atSchemaLocation)).append("\n");
sb.append(" atBaseType: ").append(toIndentedString(atBaseType)).append("\n");
sb.append(" atType: ").append(toIndentedString(atType)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,210 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 org.openapitools.model.EntityRef;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* FooRef
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class FooRef extends EntityRef implements FooRefOrValue {
@JsonProperty("foorefPropA")
private String foorefPropA;
@JsonProperty("href")
private String href;
@JsonProperty("id")
private String id;
@JsonProperty("@schemaLocation")
private String atSchemaLocation;
@JsonProperty("@baseType")
private String atBaseType;
@JsonProperty("@type")
private String atType;
public FooRef foorefPropA(String foorefPropA) {
this.foorefPropA = foorefPropA;
return this;
}
/**
* Get foorefPropA
* @return foorefPropA
*/
@Schema(name = "foorefPropA", required = false)
public String getFoorefPropA() {
return foorefPropA;
}
public void setFoorefPropA(String foorefPropA) {
this.foorefPropA = foorefPropA;
}
public FooRef href(String href) {
this.href = href;
return this;
}
/**
* Hyperlink reference
* @return href
*/
@Schema(name = "href", description = "Hyperlink reference", required = false)
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public FooRef id(String id) {
this.id = id;
return this;
}
/**
* unique identifier
* @return id
*/
@Schema(name = "id", description = "unique identifier", required = false)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public FooRef atSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
return this;
}
/**
* A URI to a JSON-Schema file that defines additional attributes and relationships
* @return atSchemaLocation
*/
@Schema(name = "@schemaLocation", description = "A URI to a JSON-Schema file that defines additional attributes and relationships", required = false)
public String getAtSchemaLocation() {
return atSchemaLocation;
}
public void setAtSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
}
public FooRef atBaseType(String atBaseType) {
this.atBaseType = atBaseType;
return this;
}
/**
* When sub-classing, this defines the super-class
* @return atBaseType
*/
@Schema(name = "@baseType", description = "When sub-classing, this defines the super-class", required = false)
public String getAtBaseType() {
return atBaseType;
}
public void setAtBaseType(String atBaseType) {
this.atBaseType = atBaseType;
}
public FooRef atType(String atType) {
this.atType = atType;
return this;
}
/**
* When sub-classing, this defines the sub-class Extensible name
* @return atType
*/
@NotNull
@Schema(name = "@type", description = "When sub-classing, this defines the sub-class Extensible name", required = true)
public String getAtType() {
return atType;
}
public void setAtType(String atType) {
this.atType = atType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FooRef fooRef = (FooRef) o;
return Objects.equals(this.foorefPropA, fooRef.foorefPropA) &&
Objects.equals(this.href, fooRef.href) &&
Objects.equals(this.id, fooRef.id) &&
Objects.equals(this.atSchemaLocation, fooRef.atSchemaLocation) &&
Objects.equals(this.atBaseType, fooRef.atBaseType) &&
Objects.equals(this.atType, fooRef.atType) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(foorefPropA, href, id, atSchemaLocation, atBaseType, atType, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FooRef {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" foorefPropA: ").append(toIndentedString(foorefPropA)).append("\n");
sb.append(" href: ").append(toIndentedString(href)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" atSchemaLocation: ").append(toIndentedString(atSchemaLocation)).append("\n");
sb.append(" atBaseType: ").append(toIndentedString(atBaseType)).append("\n");
sb.append(" atType: ").append(toIndentedString(atType)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,36 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 org.openapitools.model.Foo;
import org.openapitools.model.FooRef;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
@JsonIgnoreProperties(
value = "@type", // ignore manually set @type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the @type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Foo.class, name = "Foo"),
@JsonSubTypes.Type(value = FooRef.class, name = "FooRef")
})
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public interface FooRefOrValue {
public String getAtType();
}

View File

@@ -0,0 +1,3 @@
server.port=8080
spring.jackson.date-format=org.openapitools.RFC3339DateFormat
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false

View File

@@ -0,0 +1,205 @@
openapi: 3.0.1
info:
description: |
This tests for a oneOf interface representation
title: ByRefOrValue
version: 0.0.1
servers:
- url: http://localhost:8080
tags:
- name: Foo
- name: Bar
paths:
/foo:
get:
operationId: getAllFoos
responses:
"200":
content:
application/json;charset=utf-8:
schema:
items:
$ref: '#/components/schemas/FooRefOrValue'
type: array
description: Success
summary: GET all Foos
tags:
- Foo
x-accepts: application/json;charset=utf-8
x-tags:
- tag: Foo
post:
operationId: createFoo
requestBody:
$ref: '#/components/requestBodies/Foo'
responses:
"201":
content:
application/json:
schema:
$ref: '#/components/schemas/FooRefOrValue'
description: Error
summary: Create a Foo
tags:
- Foo
x-contentType: application/json;charset=utf-8
x-accepts: application/json
x-tags:
- tag: Foo
/bar:
post:
operationId: createBar
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Bar_Create'
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/Bar'
description: Bar created
summary: Create a Bar
tags:
- Bar
x-contentType: application/json
x-accepts: application/json
x-tags:
- tag: Bar
components:
requestBodies:
Foo:
content:
application/json;charset=utf-8:
schema:
$ref: '#/components/schemas/Foo'
description: The Foo to be created
responses:
"204":
content: {}
description: Deleted
"201Foo":
content:
application/json:
schema:
$ref: '#/components/schemas/FooRefOrValue'
description: Error
"200FooArray":
content:
application/json;charset=utf-8:
schema:
items:
$ref: '#/components/schemas/FooRefOrValue'
type: array
description: Success
schemas:
Addressable:
description: Base schema for adressable entities
properties:
href:
description: Hyperlink reference
type: string
id:
description: unique identifier
type: string
type: object
Extensible:
properties:
'@schemaLocation':
description: A URI to a JSON-Schema file that defines additional attributes
and relationships
type: string
'@baseType':
description: "When sub-classing, this defines the super-class"
type: string
'@type':
description: "When sub-classing, this defines the sub-class Extensible name"
type: string
required:
- '@type'
type: object
Entity:
allOf:
- $ref: '#/components/schemas/Addressable'
- $ref: '#/components/schemas/Extensible'
discriminator:
propertyName: '@type'
type: object
EntityRef:
allOf:
- $ref: '#/components/schemas/Addressable'
- $ref: '#/components/schemas/Extensible'
description: Entity reference schema to be use for all entityRef class.
discriminator:
propertyName: '@type'
properties:
name:
description: Name of the related entity.
type: string
'@referredType':
description: The actual type of the target instance when needed for disambiguation.
type: string
type: object
FooRefOrValue:
discriminator:
propertyName: '@type'
oneOf:
- $ref: '#/components/schemas/Foo'
- $ref: '#/components/schemas/FooRef'
type: object
x-one-of-name: FooRefOrValue
Foo:
allOf:
- $ref: '#/components/schemas/Entity'
example:
fooPropA: fooPropA
fooPropB: fooPropB
properties:
fooPropA:
type: string
fooPropB:
type: string
type: object
FooRef:
allOf:
- $ref: '#/components/schemas/EntityRef'
discriminator:
propertyName: '@type'
properties:
foorefPropA:
type: string
type: object
Bar_Create:
allOf:
- $ref: '#/components/schemas/Entity'
properties:
barPropA:
type: string
fooPropB:
type: string
foo:
$ref: '#/components/schemas/FooRefOrValue'
type: object
Bar:
allOf:
- $ref: '#/components/schemas/Entity'
example:
foo: null
id: id
fooPropB: fooPropB
barPropA: barPropA
properties:
id:
type: string
barPropA:
type: string
fooPropB:
type: string
foo:
$ref: '#/components/schemas/FooRefOrValue'
required:
- id
type: object

View File

@@ -0,0 +1,13 @@
package org.openapitools;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class OpenApiGeneratorApplicationTests {
@Test
void contextLoads() {
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
@JsonProperty("name")
private String name;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesArray extends HashMap<String, List> {
public class AdditionalPropertiesArray extends HashMap<String, List> {
@JsonProperty("name")
private String name;

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
@JsonProperty("name")
private String name;

View File

@@ -22,7 +22,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesClass {
public class AdditionalPropertiesClass {
@JsonProperty("map_string")
@Valid

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
@JsonProperty("name")
private String name;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
@JsonProperty("name")
private String name;

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesObject extends HashMap<String, Map> {
public class AdditionalPropertiesObject extends HashMap<String, Map> {
@JsonProperty("name")
private String name;

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesString extends HashMap<String, String> {
public class AdditionalPropertiesString extends HashMap<String, String> {
@JsonProperty("name")
private String name;

View File

@@ -7,6 +7,9 @@ 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 org.openapitools.model.BigCat;
import org.openapitools.model.Cat;
import org.openapitools.model.Dog;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
@@ -28,10 +31,11 @@ import javax.annotation.Generated;
@JsonSubTypes({
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog")
})
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Animal {
public class Animal {
@JsonProperty("className")
private String className;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ArrayOfArrayOfNumberOnly {
public class ArrayOfArrayOfNumberOnly {
@JsonProperty("ArrayArrayNumber")
@Valid

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ArrayOfNumberOnly {
public class ArrayOfNumberOnly {
@JsonProperty("ArrayNumber")
@Valid

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ArrayTest {
public class ArrayTest {
@JsonProperty("array_of_string")
@Valid

View File

@@ -2,8 +2,11 @@ package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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.JsonValue;
import org.openapitools.model.BigCatAllOf;
import org.openapitools.model.Cat;
@@ -20,8 +23,9 @@ import javax.annotation.Generated;
* BigCat
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class BigCat extends Cat {
public class BigCat extends Cat {
/**
* Gets or Sets kind

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
@JsonTypeName("BigCat_allOf")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class BigCatAllOf {
public class BigCatAllOf {
/**
* Gets or Sets kind

View File

@@ -18,7 +18,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Capitalization {
public class Capitalization {
@JsonProperty("smallCamel")
private String smallCamel;

View File

@@ -2,9 +2,13 @@ package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 org.openapitools.model.Animal;
import org.openapitools.model.BigCat;
import org.openapitools.model.CatAllOf;
import java.time.OffsetDateTime;
import javax.validation.Valid;
@@ -19,8 +23,17 @@ import javax.annotation.Generated;
* Cat
*/
@JsonIgnoreProperties(
value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the className to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat")
})
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Cat extends Animal {
public class Cat extends Animal {
@JsonProperty("declawed")
private Boolean declawed;

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
@JsonTypeName("Cat_allOf")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class CatAllOf {
public class CatAllOf {
@JsonProperty("declawed")
private Boolean declawed;

View File

@@ -18,7 +18,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Category {
public class Category {
@JsonProperty("id")
private Long id;

View File

@@ -19,7 +19,7 @@ import javax.annotation.Generated;
@Schema(name = "ClassModel", description = "Model for testing model with \"_class\" property")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ClassModel {
public class ClassModel {
@JsonProperty("_class")
private String propertyClass;

View File

@@ -18,7 +18,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Client {
public class Client {
@JsonProperty("client")
private String client;

View File

@@ -2,8 +2,11 @@ package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 org.openapitools.model.Animal;
import org.openapitools.model.DogAllOf;
import java.time.OffsetDateTime;
@@ -19,8 +22,9 @@ import javax.annotation.Generated;
* Dog
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Dog extends Animal {
public class Dog extends Animal {
@JsonProperty("breed")
private String breed;

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
@JsonTypeName("Dog_allOf")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class DogAllOf {
public class DogAllOf {
@JsonProperty("breed")
private String breed;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class EnumArrays {
public class EnumArrays {
/**
* Gets or Sets justSymbol

View File

@@ -22,7 +22,7 @@ import javax.annotation.Generated;
@JsonTypeName("Enum_Test")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class EnumTest {
public class EnumTest {
/**
* Gets or Sets enumString

View File

@@ -19,7 +19,7 @@ import javax.annotation.Generated;
@Schema(name = "File", description = "Must be named `File` for test.")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class File {
public class File {
@JsonProperty("sourceURI")
private String sourceURI;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class FileSchemaTestClass {
public class FileSchemaTestClass {
@JsonProperty("file")
private File file;

View File

@@ -26,7 +26,7 @@ import javax.annotation.Generated;
@JsonTypeName("format_test")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class FormatTest {
public class FormatTest {
@JsonProperty("integer")
private Integer integer;

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
@JsonTypeName("hasOnlyReadOnly")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class HasOnlyReadOnly {
public class HasOnlyReadOnly {
@JsonProperty("bar")
private String bar;

View File

@@ -22,7 +22,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class MapTest {
public class MapTest {
@JsonProperty("map_map_of_string")
@Valid

View File

@@ -25,7 +25,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class MixedPropertiesAndAdditionalPropertiesClass {
public class MixedPropertiesAndAdditionalPropertiesClass {
@JsonProperty("uuid")
private UUID uuid;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
@Schema(name = "200_response", description = "Model for testing model name starting with number")
@JsonTypeName("200_response")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Model200Response {
public class Model200Response {
@JsonProperty("name")
private Integer name;

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
@JsonTypeName("ApiResponse")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ModelApiResponse {
public class ModelApiResponse {
@JsonProperty("code")
private Integer code;

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
@JsonTypeName("List")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ModelList {
public class ModelList {
@JsonProperty("123-list")
private String _123list;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
@Schema(name = "Return", description = "Model for testing reserved words")
@JsonTypeName("Return")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ModelReturn {
public class ModelReturn {
@JsonProperty("return")
private Integer _return;

View File

@@ -19,7 +19,7 @@ import javax.annotation.Generated;
@Schema(name = "Name", description = "Model for testing model name same as property name")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Name {
public class Name {
@JsonProperty("name")
private Integer name;

View File

@@ -19,7 +19,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class NumberOnly {
public class NumberOnly {
@JsonProperty("JustNumber")
private BigDecimal justNumber;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Order {
public class Order {
@JsonProperty("id")
private Long id;

View File

@@ -19,7 +19,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class OuterComposite {
public class OuterComposite {
@JsonProperty("my_number")
private BigDecimal myNumber;

View File

@@ -26,7 +26,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Pet {
public class Pet {
@JsonProperty("id")
private Long id;

View File

@@ -18,7 +18,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ReadOnlyFirst {
public class ReadOnlyFirst {
@JsonProperty("bar")
private String bar;

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
@JsonTypeName("$special[model.name]")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class SpecialModelName {
public class SpecialModelName {
@JsonProperty("$special[property.name]")
private Long $specialPropertyName;

View File

@@ -18,7 +18,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Tag {
public class Tag {
@JsonProperty("id")
private Long id;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class TypeHolderDefault {
public class TypeHolderDefault {
@JsonProperty("string_item")
private String stringItem = "what";

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class TypeHolderExample {
public class TypeHolderExample {
@JsonProperty("string_item")
private String stringItem;

View File

@@ -18,7 +18,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class User {
public class User {
@JsonProperty("id")
private Long id;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class XmlItem {
public class XmlItem {
@JsonProperty("attribute_string")
private String attributeString;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
@JsonProperty("name")
private String name;

View File

@@ -22,7 +22,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesArray extends HashMap<String, List> {
public class AdditionalPropertiesArray extends HashMap<String, List> {
@JsonProperty("name")
private String name;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
@JsonProperty("name")
private String name;

View File

@@ -23,7 +23,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesClass {
public class AdditionalPropertiesClass {
@JsonProperty("map_string")
@Valid

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
@JsonProperty("name")
private String name;

View File

@@ -22,7 +22,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
@JsonProperty("name")
private String name;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesObject extends HashMap<String, Map> {
public class AdditionalPropertiesObject extends HashMap<String, Map> {
@JsonProperty("name")
private String name;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class AdditionalPropertiesString extends HashMap<String, String> {
public class AdditionalPropertiesString extends HashMap<String, String> {
@JsonProperty("name")
private String name;

View File

@@ -7,6 +7,9 @@ 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 org.openapitools.model.BigCat;
import org.openapitools.model.Cat;
import org.openapitools.model.Dog;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
@@ -29,10 +32,11 @@ import javax.annotation.Generated;
@JsonSubTypes({
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog")
})
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Animal {
public class Animal {
@JsonProperty("className")
private String className;

View File

@@ -22,7 +22,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ArrayOfArrayOfNumberOnly {
public class ArrayOfArrayOfNumberOnly {
@JsonProperty("ArrayArrayNumber")
@Valid

View File

@@ -22,7 +22,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ArrayOfNumberOnly {
public class ArrayOfNumberOnly {
@JsonProperty("ArrayNumber")
@Valid

View File

@@ -22,7 +22,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ArrayTest {
public class ArrayTest {
@JsonProperty("array_of_string")
@Valid

View File

@@ -2,8 +2,11 @@ package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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.JsonValue;
import org.openapitools.model.BigCatAllOf;
import org.openapitools.model.Cat;
@@ -21,8 +24,9 @@ import javax.annotation.Generated;
* BigCat
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class BigCat extends Cat {
public class BigCat extends Cat {
/**
* Gets or Sets kind

View File

@@ -22,7 +22,7 @@ import javax.annotation.Generated;
@JsonTypeName("BigCat_allOf")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class BigCatAllOf {
public class BigCatAllOf {
/**
* Gets or Sets kind

View File

@@ -19,7 +19,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Capitalization {
public class Capitalization {
@JsonProperty("smallCamel")
private String smallCamel;

View File

@@ -2,9 +2,13 @@ package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 org.openapitools.model.Animal;
import org.openapitools.model.BigCat;
import org.openapitools.model.CatAllOf;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
@@ -20,8 +24,17 @@ import javax.annotation.Generated;
* Cat
*/
@JsonIgnoreProperties(
value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the className to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat")
})
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Cat extends Animal {
public class Cat extends Animal {
@JsonProperty("declawed")
private Boolean declawed;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
@JsonTypeName("Cat_allOf")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class CatAllOf {
public class CatAllOf {
@JsonProperty("declawed")
private Boolean declawed;

View File

@@ -19,7 +19,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Category {
public class Category {
@JsonProperty("id")
private Long id;

View File

@@ -20,7 +20,7 @@ import javax.annotation.Generated;
@Schema(name = "ClassModel", description = "Model for testing model with \"_class\" property")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class ClassModel {
public class ClassModel {
@JsonProperty("_class")
private String propertyClass;

View File

@@ -19,7 +19,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Client {
public class Client {
@JsonProperty("client")
private String client;

View File

@@ -2,8 +2,11 @@ package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 org.openapitools.model.Animal;
import org.openapitools.model.DogAllOf;
import org.openapitools.jackson.nullable.JsonNullable;
@@ -20,8 +23,9 @@ import javax.annotation.Generated;
* Dog
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Dog extends Animal {
public class Dog extends Animal {
@JsonProperty("breed")
private String breed;

View File

@@ -21,7 +21,7 @@ import javax.annotation.Generated;
@JsonTypeName("Dog_allOf")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class DogAllOf {
public class DogAllOf {
@JsonProperty("breed")
private String breed;

View File

@@ -22,7 +22,7 @@ import javax.annotation.Generated;
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class EnumArrays {
public class EnumArrays {
/**
* Gets or Sets justSymbol

Some files were not shown because too many files have changed in this diff Show More