mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-13 16:03:43 +00:00
[Java] [Spring] Use deduction configOptions for oneOfInterfaces (#20919)
* fix(java): x-discriminator-value should not produce @JsonTypeName * fix(java): Remove unused getDiscriminatorValue() * build at Fednot * build at Fednot * build at Fednot: skip sonar * scm for release at fednot * build fednot not 7.5.0-FEDNOT-SNAPSHOT * build fednot not 7.5.0-FEDNOT-SNAPSHOT * test all vars * rollback custom pom.xml * commit master * commit test * Samples for deduction * add files for deduction * small improvements * Merge changes from martin-mfg Merge master * Merge changes from martin-mfg Merge master * Merge changes from martin-mfg Add comment to force rebuild * Merge master * regenerate doc * regenerate client * regenerate client --------- Co-authored-by: Jean-Paul Finne <jean-paul.finne@fednot.be> Co-authored-by: martin-mfg <2026226+martin-mfg@users.noreply.github.com>
This commit is contained in:
parent
731668b199
commit
7e9b9615db
3
.github/workflows/samples-spring-jdk17.yaml
vendored
3
.github/workflows/samples-spring-jdk17.yaml
vendored
@ -11,6 +11,7 @@ on:
|
||||
- samples/server/petstore/springboot-file-delegate-optional
|
||||
- samples/server/petstore/springboot-petstore-with-api-response-examples
|
||||
- samples/server/petstore/spring-boot-oneof-sealed
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-interface
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
|
||||
@ -21,6 +22,7 @@ on:
|
||||
- samples/server/petstore/springboot-file-delegate-optional
|
||||
- samples/server/petstore/springboot-petstore-with-api-response-examples
|
||||
- samples/server/petstore/spring-boot-oneof-sealed
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-interface
|
||||
jobs:
|
||||
build:
|
||||
name: Build Java Spring (JDK17)
|
||||
@ -39,6 +41,7 @@ jobs:
|
||||
- samples/server/petstore/springboot-file-delegate-optional
|
||||
- samples/server/petstore/springboot-petstore-with-api-response-examples
|
||||
- samples/server/petstore/spring-boot-oneof-sealed
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-interface
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-java@v5
|
||||
|
1
.github/workflows/samples-spring.yaml
vendored
1
.github/workflows/samples-spring.yaml
vendored
@ -60,6 +60,7 @@ jobs:
|
||||
- samples/server/petstore/springboot-spring-provide-args
|
||||
- samples/server/petstore/springboot-useoptional
|
||||
- samples/server/petstore/springboot-virtualan
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-interface
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-java@v5
|
||||
|
12
bin/configs/spring-boot-oneof-interface.yaml
Normal file
12
bin/configs/spring-boot-oneof-interface.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/server/petstore/spring-boot-oneof-interface
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
documentationProvider: springdoc
|
||||
artifactId: springboot-oneof
|
||||
snapshotVersion: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
useOneOfInterfaces: "true"
|
||||
useDeductionForOneOfInterfaces: "true"
|
@ -99,6 +99,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|title|server title name or client service name| |OpenAPI Spring|
|
||||
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|
||||
|useBeanValidation|Use BeanValidation API annotations| |true|
|
||||
|useDeductionForOneOfInterfaces|whether to use deduction for generated oneOf interfaces| |false|
|
||||
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
|
||||
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.| |true|
|
||||
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|
||||
|
@ -92,6 +92,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|title|server title name or client service name| |OpenAPI Spring|
|
||||
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|
||||
|useBeanValidation|Use BeanValidation API annotations| |true|
|
||||
|useDeductionForOneOfInterfaces|whether to use deduction for generated oneOf interfaces| |false|
|
||||
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
|
||||
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.| |true|
|
||||
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|
||||
|
@ -99,6 +99,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
public static final String USE_SEALED = "useSealed";
|
||||
public static final String OPTIONAL_ACCEPT_NULLABLE = "optionalAcceptNullable";
|
||||
public static final String USE_SPRING_BUILT_IN_VALIDATION = "useSpringBuiltInValidation";
|
||||
public static final String USE_DEDUCTION_FOR_ONE_OF_INTERFACES = "useDeductionForOneOfInterfaces";
|
||||
|
||||
@Getter
|
||||
public enum RequestMappingMode {
|
||||
@ -159,6 +160,8 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
protected boolean optionalAcceptNullable = true;
|
||||
@Getter @Setter
|
||||
protected boolean useSpringBuiltInValidation = false;
|
||||
@Getter @Setter
|
||||
protected boolean useDeductionForOneOfInterfaces = false;
|
||||
|
||||
public SpringCodegen() {
|
||||
super();
|
||||
@ -282,6 +285,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
"Use `ofNullable` instead of just `of` to accept null values when using Optional.",
|
||||
optionalAcceptNullable));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "whether to use deduction for generated oneOf interfaces", useDeductionForOneOfInterfaces));
|
||||
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
|
||||
supportedLibraries.put(SPRING_CLOUD_LIBRARY,
|
||||
"Spring-Cloud-Feign client with Spring-Boot auto-configured settings.");
|
||||
@ -449,6 +453,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
convertPropertyToBooleanAndWriteBack(OPTIONAL_ACCEPT_NULLABLE, this::setOptionalAcceptNullable);
|
||||
convertPropertyToBooleanAndWriteBack(USE_SPRING_BUILT_IN_VALIDATION, this::setUseSpringBuiltInValidation);
|
||||
convertPropertyToBooleanAndWriteBack(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, this::setUseDeductionForOneOfInterfaces);
|
||||
|
||||
additionalProperties.put("springHttpStatus", new SpringHttpStatusLambda());
|
||||
|
||||
|
@ -6,6 +6,14 @@
|
||||
{{#discriminator}}
|
||||
{{>typeInfoAnnotation}}
|
||||
|
||||
{{/discriminator}}{{^discriminator}}{{#useDeductionForOneOfInterfaces}}
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
|
||||
@JsonSubTypes({
|
||||
{{#interfaceModels}}
|
||||
@JsonSubTypes.Type(value = {{classname}}.class){{^-last}}, {{/-last}}
|
||||
{{/interfaceModels}}
|
||||
})
|
||||
{{/useDeductionForOneOfInterfaces}}
|
||||
{{/discriminator}}
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
|
@ -1764,10 +1764,13 @@ public class SpringCodegenTest {
|
||||
generator.setGeneratorPropertyDefault(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "false");
|
||||
|
||||
codegen.setUseOneOfInterfaces(true);
|
||||
codegen.setUseDeductionForOneOfInterfaces(true);
|
||||
codegen.setLegacyDiscriminatorBehavior(false);
|
||||
|
||||
generator.opts(input).generate();
|
||||
|
||||
// test deduction
|
||||
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/Animal.java"), "@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)", "@JsonSubTypes.Type(value = Dog.class),", "@JsonSubTypes.Type(value = Cat.class)");
|
||||
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/Foo.java"), "public class Foo extends Entity implements FooRefOrValue");
|
||||
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/FooRef.java"), "public class FooRef extends EntityRef implements FooRefOrValue");
|
||||
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/FooRefOrValue.java"), "public interface FooRefOrValue");
|
||||
|
@ -209,6 +209,20 @@ components:
|
||||
properties:
|
||||
length:
|
||||
type: integer
|
||||
Animal:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/Dog'
|
||||
- $ref: '#/components/schemas/Cat'
|
||||
Cat:
|
||||
type: object
|
||||
properties:
|
||||
declawed:
|
||||
type: boolean
|
||||
Dog:
|
||||
type: object
|
||||
properties:
|
||||
bark:
|
||||
type: boolean
|
||||
|
||||
requestBodies:
|
||||
Foo:
|
||||
|
@ -0,0 +1,184 @@
|
||||
# openapi-java-client
|
||||
|
||||
OpenAPI Petstore
|
||||
- API version: 1.0.0
|
||||
- Generator version: 7.6.0-SNAPSHOT
|
||||
|
||||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
|
||||
|
||||
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
Building the API client library requires:
|
||||
1. Java 1.8+
|
||||
2. Maven (3.8.3+)/Gradle (7.2+)
|
||||
|
||||
## Installation
|
||||
|
||||
To install the API client library to your local Maven repository, simply execute:
|
||||
|
||||
```shell
|
||||
mvn clean install
|
||||
```
|
||||
|
||||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||
|
||||
```shell
|
||||
mvn clean deploy
|
||||
```
|
||||
|
||||
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
|
||||
|
||||
### Maven users
|
||||
|
||||
Add this dependency to your project's POM:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-java-client</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### Gradle users
|
||||
|
||||
Add this dependency to your project's build file:
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
mavenCentral() // Needed if the 'openapi-java-client' jar has been published to maven central.
|
||||
mavenLocal() // Needed if the 'openapi-java-client' jar has been published to the local maven repo.
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.openapitools:openapi-java-client:1.0.0"
|
||||
}
|
||||
```
|
||||
|
||||
### Others
|
||||
|
||||
At first generate the JAR by executing:
|
||||
|
||||
```shell
|
||||
mvn clean package
|
||||
```
|
||||
|
||||
Then manually install the following JARs:
|
||||
|
||||
* `target/openapi-java-client-1.0.0.jar`
|
||||
* `target/lib/*.jar`
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) instruction and execute the following Java code:
|
||||
|
||||
```java
|
||||
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.Configuration;
|
||||
import org.openapitools.client.auth.*;
|
||||
import org.openapitools.client.models.*;
|
||||
import org.openapitools.client.api.PetApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://petstore.swagger.io/v2");
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi(defaultClient);
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
Pet result = apiInstance.addPet(pet);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#addPet");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
||||
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
||||
*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
||||
*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
||||
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
||||
*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
- [Category](docs/Category.md)
|
||||
- [ModelApiResponse](docs/ModelApiResponse.md)
|
||||
- [Order](docs/Order.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [User](docs/User.md)
|
||||
|
||||
|
||||
<a id="documentation-for-authorization"></a>
|
||||
## Documentation for Authorization
|
||||
|
||||
|
||||
Authentication schemes defined for the API:
|
||||
<a id="petstore_auth"></a>
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
<a id="api_key"></a>
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
||||
## Recommendation
|
||||
|
||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
Cargo.toml
|
||||
README.md
|
||||
docs/Addressable.md
|
||||
docs/Animal.md
|
||||
docs/Apple.md
|
||||
docs/Banana.md
|
||||
docs/Bar.md
|
||||
@ -10,6 +11,8 @@ docs/BarApi.md
|
||||
docs/BarCreate.md
|
||||
docs/BarRef.md
|
||||
docs/BarRefOrValue.md
|
||||
docs/Cat.md
|
||||
docs/Dog.md
|
||||
docs/Entity.md
|
||||
docs/EntityRef.md
|
||||
docs/Extensible.md
|
||||
@ -31,12 +34,15 @@ src/apis/mod.rs
|
||||
src/apis/request.rs
|
||||
src/lib.rs
|
||||
src/models/addressable.rs
|
||||
src/models/animal.rs
|
||||
src/models/apple.rs
|
||||
src/models/banana.rs
|
||||
src/models/bar.rs
|
||||
src/models/bar_create.rs
|
||||
src/models/bar_ref.rs
|
||||
src/models/bar_ref_or_value.rs
|
||||
src/models/cat.rs
|
||||
src/models/dog.rs
|
||||
src/models/entity.rs
|
||||
src/models/entity_ref.rs
|
||||
src/models/extensible.rs
|
||||
|
@ -35,12 +35,15 @@ Class | Method | HTTP request | Description
|
||||
## Documentation For Models
|
||||
|
||||
- [Addressable](docs/Addressable.md)
|
||||
- [Animal](docs/Animal.md)
|
||||
- [Apple](docs/Apple.md)
|
||||
- [Banana](docs/Banana.md)
|
||||
- [Bar](docs/Bar.md)
|
||||
- [BarCreate](docs/BarCreate.md)
|
||||
- [BarRef](docs/BarRef.md)
|
||||
- [BarRefOrValue](docs/BarRefOrValue.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
- [Entity](docs/Entity.md)
|
||||
- [EntityRef](docs/EntityRef.md)
|
||||
- [Extensible](docs/Extensible.md)
|
||||
|
12
samples/client/others/rust/hyper/oneOf/docs/Animal.md
Normal file
12
samples/client/others/rust/hyper/oneOf/docs/Animal.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Animal
|
||||
|
||||
## Enum Variants
|
||||
|
||||
| Name | Description |
|
||||
|---- | -----|
|
||||
| Cat | |
|
||||
| Dog | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
11
samples/client/others/rust/hyper/oneOf/docs/Cat.md
Normal file
11
samples/client/others/rust/hyper/oneOf/docs/Cat.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Cat
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**declawed** | Option<**bool**> | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
11
samples/client/others/rust/hyper/oneOf/docs/Dog.md
Normal file
11
samples/client/others/rust/hyper/oneOf/docs/Dog.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Dog
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**bark** | Option<**bool**> | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
26
samples/client/others/rust/hyper/oneOf/src/models/animal.rs
Normal file
26
samples/client/others/rust/hyper/oneOf/src/models/animal.rs
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* ByRefOrValue
|
||||
*
|
||||
* This tests for a oneOf interface representation
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.1
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum Animal {
|
||||
Dog(Box<models::Dog>),
|
||||
Cat(Box<models::Cat>),
|
||||
}
|
||||
|
||||
impl Default for Animal {
|
||||
fn default() -> Self {
|
||||
Self::Dog(Default::default())
|
||||
}
|
||||
}
|
||||
|
27
samples/client/others/rust/hyper/oneOf/src/models/cat.rs
Normal file
27
samples/client/others/rust/hyper/oneOf/src/models/cat.rs
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* ByRefOrValue
|
||||
*
|
||||
* This tests for a oneOf interface representation
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.1
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Cat {
|
||||
#[serde(rename = "declawed", skip_serializing_if = "Option::is_none")]
|
||||
pub declawed: Option<bool>,
|
||||
}
|
||||
|
||||
impl Cat {
|
||||
pub fn new() -> Cat {
|
||||
Cat {
|
||||
declawed: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
samples/client/others/rust/hyper/oneOf/src/models/dog.rs
Normal file
27
samples/client/others/rust/hyper/oneOf/src/models/dog.rs
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* ByRefOrValue
|
||||
*
|
||||
* This tests for a oneOf interface representation
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.1
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Dog {
|
||||
#[serde(rename = "bark", skip_serializing_if = "Option::is_none")]
|
||||
pub bark: Option<bool>,
|
||||
}
|
||||
|
||||
impl Dog {
|
||||
pub fn new() -> Dog {
|
||||
Dog {
|
||||
bark: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
pub mod addressable;
|
||||
pub use self::addressable::Addressable;
|
||||
pub mod animal;
|
||||
pub use self::animal::Animal;
|
||||
pub mod apple;
|
||||
pub use self::apple::Apple;
|
||||
pub mod banana;
|
||||
@ -12,6 +14,10 @@ pub mod bar_ref;
|
||||
pub use self::bar_ref::BarRef;
|
||||
pub mod bar_ref_or_value;
|
||||
pub use self::bar_ref_or_value::BarRefOrValue;
|
||||
pub mod cat;
|
||||
pub use self::cat::Cat;
|
||||
pub mod dog;
|
||||
pub use self::dog::Dog;
|
||||
pub mod entity;
|
||||
pub use self::entity::Entity;
|
||||
pub mod entity_ref;
|
||||
|
@ -3,6 +3,7 @@
|
||||
Cargo.toml
|
||||
README.md
|
||||
docs/Addressable.md
|
||||
docs/Animal.md
|
||||
docs/Apple.md
|
||||
docs/Banana.md
|
||||
docs/Bar.md
|
||||
@ -10,6 +11,8 @@ docs/BarApi.md
|
||||
docs/BarCreate.md
|
||||
docs/BarRef.md
|
||||
docs/BarRefOrValue.md
|
||||
docs/Cat.md
|
||||
docs/Dog.md
|
||||
docs/Entity.md
|
||||
docs/EntityRef.md
|
||||
docs/Extensible.md
|
||||
@ -29,12 +32,15 @@ src/apis/foo_api.rs
|
||||
src/apis/mod.rs
|
||||
src/lib.rs
|
||||
src/models/addressable.rs
|
||||
src/models/animal.rs
|
||||
src/models/apple.rs
|
||||
src/models/banana.rs
|
||||
src/models/bar.rs
|
||||
src/models/bar_create.rs
|
||||
src/models/bar_ref.rs
|
||||
src/models/bar_ref_or_value.rs
|
||||
src/models/cat.rs
|
||||
src/models/dog.rs
|
||||
src/models/entity.rs
|
||||
src/models/entity_ref.rs
|
||||
src/models/extensible.rs
|
||||
|
@ -35,12 +35,15 @@ Class | Method | HTTP request | Description
|
||||
## Documentation For Models
|
||||
|
||||
- [Addressable](docs/Addressable.md)
|
||||
- [Animal](docs/Animal.md)
|
||||
- [Apple](docs/Apple.md)
|
||||
- [Banana](docs/Banana.md)
|
||||
- [Bar](docs/Bar.md)
|
||||
- [BarCreate](docs/BarCreate.md)
|
||||
- [BarRef](docs/BarRef.md)
|
||||
- [BarRefOrValue](docs/BarRefOrValue.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
- [Entity](docs/Entity.md)
|
||||
- [EntityRef](docs/EntityRef.md)
|
||||
- [Extensible](docs/Extensible.md)
|
||||
|
12
samples/client/others/rust/reqwest/oneOf/docs/Animal.md
Normal file
12
samples/client/others/rust/reqwest/oneOf/docs/Animal.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Animal
|
||||
|
||||
## Enum Variants
|
||||
|
||||
| Name | Description |
|
||||
|---- | -----|
|
||||
| Cat | |
|
||||
| Dog | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
11
samples/client/others/rust/reqwest/oneOf/docs/Cat.md
Normal file
11
samples/client/others/rust/reqwest/oneOf/docs/Cat.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Cat
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**declawed** | Option<**bool**> | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
11
samples/client/others/rust/reqwest/oneOf/docs/Dog.md
Normal file
11
samples/client/others/rust/reqwest/oneOf/docs/Dog.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Dog
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**bark** | Option<**bool**> | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* ByRefOrValue
|
||||
*
|
||||
* This tests for a oneOf interface representation
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.1
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum Animal {
|
||||
Dog(Box<models::Dog>),
|
||||
Cat(Box<models::Cat>),
|
||||
}
|
||||
|
||||
impl Default for Animal {
|
||||
fn default() -> Self {
|
||||
Self::Dog(Default::default())
|
||||
}
|
||||
}
|
||||
|
27
samples/client/others/rust/reqwest/oneOf/src/models/cat.rs
Normal file
27
samples/client/others/rust/reqwest/oneOf/src/models/cat.rs
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* ByRefOrValue
|
||||
*
|
||||
* This tests for a oneOf interface representation
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.1
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Cat {
|
||||
#[serde(rename = "declawed", skip_serializing_if = "Option::is_none")]
|
||||
pub declawed: Option<bool>,
|
||||
}
|
||||
|
||||
impl Cat {
|
||||
pub fn new() -> Cat {
|
||||
Cat {
|
||||
declawed: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
samples/client/others/rust/reqwest/oneOf/src/models/dog.rs
Normal file
27
samples/client/others/rust/reqwest/oneOf/src/models/dog.rs
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* ByRefOrValue
|
||||
*
|
||||
* This tests for a oneOf interface representation
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.1
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Dog {
|
||||
#[serde(rename = "bark", skip_serializing_if = "Option::is_none")]
|
||||
pub bark: Option<bool>,
|
||||
}
|
||||
|
||||
impl Dog {
|
||||
pub fn new() -> Dog {
|
||||
Dog {
|
||||
bark: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
pub mod addressable;
|
||||
pub use self::addressable::Addressable;
|
||||
pub mod animal;
|
||||
pub use self::animal::Animal;
|
||||
pub mod apple;
|
||||
pub use self::apple::Apple;
|
||||
pub mod banana;
|
||||
@ -12,6 +14,10 @@ pub mod bar_ref;
|
||||
pub use self::bar_ref::BarRef;
|
||||
pub mod bar_ref_or_value;
|
||||
pub use self::bar_ref_or_value::BarRefOrValue;
|
||||
pub mod cat;
|
||||
pub use self::cat::Cat;
|
||||
pub mod dog;
|
||||
pub use self::dog::Dog;
|
||||
pub mod entity;
|
||||
pub use self::entity::Entity;
|
||||
pub mod entity_ref;
|
||||
|
@ -2,6 +2,7 @@
|
||||
README.md
|
||||
analysis_options.yaml
|
||||
doc/Addressable.md
|
||||
doc/Animal.md
|
||||
doc/Apple.md
|
||||
doc/Banana.md
|
||||
doc/Bar.md
|
||||
@ -9,6 +10,8 @@ doc/BarApi.md
|
||||
doc/BarCreate.md
|
||||
doc/BarRef.md
|
||||
doc/BarRefOrValue.md
|
||||
doc/Cat.md
|
||||
doc/Dog.md
|
||||
doc/Entity.md
|
||||
doc/EntityRef.md
|
||||
doc/Extensible.md
|
||||
@ -33,13 +36,16 @@ lib/src/auth/bearer_auth.dart
|
||||
lib/src/auth/oauth.dart
|
||||
lib/src/date_serializer.dart
|
||||
lib/src/model/addressable.dart
|
||||
lib/src/model/animal.dart
|
||||
lib/src/model/apple.dart
|
||||
lib/src/model/banana.dart
|
||||
lib/src/model/bar.dart
|
||||
lib/src/model/bar_create.dart
|
||||
lib/src/model/bar_ref.dart
|
||||
lib/src/model/bar_ref_or_value.dart
|
||||
lib/src/model/cat.dart
|
||||
lib/src/model/date.dart
|
||||
lib/src/model/dog.dart
|
||||
lib/src/model/entity.dart
|
||||
lib/src/model/entity_ref.dart
|
||||
lib/src/model/extensible.dart
|
||||
|
@ -74,12 +74,15 @@ Class | Method | HTTP request | Description
|
||||
## Documentation For Models
|
||||
|
||||
- [Addressable](doc/Addressable.md)
|
||||
- [Animal](doc/Animal.md)
|
||||
- [Apple](doc/Apple.md)
|
||||
- [Banana](doc/Banana.md)
|
||||
- [Bar](doc/Bar.md)
|
||||
- [BarCreate](doc/BarCreate.md)
|
||||
- [BarRef](doc/BarRef.md)
|
||||
- [BarRefOrValue](doc/BarRefOrValue.md)
|
||||
- [Cat](doc/Cat.md)
|
||||
- [Dog](doc/Dog.md)
|
||||
- [Entity](doc/Entity.md)
|
||||
- [EntityRef](doc/EntityRef.md)
|
||||
- [Extensible](doc/Extensible.md)
|
||||
|
@ -0,0 +1,16 @@
|
||||
# openapi.model.Animal
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**bark** | **bool** | | [optional]
|
||||
**declawed** | **bool** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,15 @@
|
||||
# openapi.model.Cat
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**declawed** | **bool** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,15 @@
|
||||
# openapi.model.Dog
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**bark** | **bool** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -14,12 +14,15 @@ export 'package:openapi/src/api/bar_api.dart';
|
||||
export 'package:openapi/src/api/foo_api.dart';
|
||||
|
||||
export 'package:openapi/src/model/addressable.dart';
|
||||
export 'package:openapi/src/model/animal.dart';
|
||||
export 'package:openapi/src/model/apple.dart';
|
||||
export 'package:openapi/src/model/banana.dart';
|
||||
export 'package:openapi/src/model/bar.dart';
|
||||
export 'package:openapi/src/model/bar_create.dart';
|
||||
export 'package:openapi/src/model/bar_ref.dart';
|
||||
export 'package:openapi/src/model/bar_ref_or_value.dart';
|
||||
export 'package:openapi/src/model/cat.dart';
|
||||
export 'package:openapi/src/model/dog.dart';
|
||||
export 'package:openapi/src/model/entity.dart';
|
||||
export 'package:openapi/src/model/entity_ref.dart';
|
||||
export 'package:openapi/src/model/extensible.dart';
|
||||
|
@ -0,0 +1,73 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
// ignore_for_file: unused_element
|
||||
import 'package:openapi/src/model/dog.dart';
|
||||
import 'package:openapi/src/model/cat.dart';
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
import 'package:one_of/one_of.dart';
|
||||
|
||||
part 'animal.g.dart';
|
||||
|
||||
/// Animal
|
||||
///
|
||||
/// Properties:
|
||||
/// * [bark]
|
||||
/// * [declawed]
|
||||
@BuiltValue()
|
||||
abstract class Animal implements Built<Animal, AnimalBuilder> {
|
||||
/// One Of [Cat], [Dog]
|
||||
OneOf get oneOf;
|
||||
|
||||
Animal._();
|
||||
|
||||
factory Animal([void updates(AnimalBuilder b)]) = _$Animal;
|
||||
|
||||
@BuiltValueHook(initializeBuilder: true)
|
||||
static void _defaults(AnimalBuilder b) => b;
|
||||
|
||||
@BuiltValueSerializer(custom: true)
|
||||
static Serializer<Animal> get serializer => _$AnimalSerializer();
|
||||
}
|
||||
|
||||
class _$AnimalSerializer implements PrimitiveSerializer<Animal> {
|
||||
@override
|
||||
final Iterable<Type> types = const [Animal, _$Animal];
|
||||
|
||||
@override
|
||||
final String wireName = r'Animal';
|
||||
|
||||
Iterable<Object?> _serializeProperties(
|
||||
Serializers serializers,
|
||||
Animal object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) sync* {
|
||||
}
|
||||
|
||||
@override
|
||||
Object serialize(
|
||||
Serializers serializers,
|
||||
Animal object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
final oneOf = object.oneOf;
|
||||
return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Animal deserialize(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
final result = AnimalBuilder();
|
||||
Object? oneOfDataSrc;
|
||||
final targetType = const FullType(OneOf, [FullType(Dog), FullType(Cat), ]);
|
||||
oneOfDataSrc = serialized;
|
||||
result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf;
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,108 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
// ignore_for_file: unused_element
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'cat.g.dart';
|
||||
|
||||
/// Cat
|
||||
///
|
||||
/// Properties:
|
||||
/// * [declawed]
|
||||
@BuiltValue()
|
||||
abstract class Cat implements Built<Cat, CatBuilder> {
|
||||
@BuiltValueField(wireName: r'declawed')
|
||||
bool? get declawed;
|
||||
|
||||
Cat._();
|
||||
|
||||
factory Cat([void updates(CatBuilder b)]) = _$Cat;
|
||||
|
||||
@BuiltValueHook(initializeBuilder: true)
|
||||
static void _defaults(CatBuilder b) => b;
|
||||
|
||||
@BuiltValueSerializer(custom: true)
|
||||
static Serializer<Cat> get serializer => _$CatSerializer();
|
||||
}
|
||||
|
||||
class _$CatSerializer implements PrimitiveSerializer<Cat> {
|
||||
@override
|
||||
final Iterable<Type> types = const [Cat, _$Cat];
|
||||
|
||||
@override
|
||||
final String wireName = r'Cat';
|
||||
|
||||
Iterable<Object?> _serializeProperties(
|
||||
Serializers serializers,
|
||||
Cat object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) sync* {
|
||||
if (object.declawed != null) {
|
||||
yield r'declawed';
|
||||
yield serializers.serialize(
|
||||
object.declawed,
|
||||
specifiedType: const FullType(bool),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Object serialize(
|
||||
Serializers serializers,
|
||||
Cat object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
|
||||
}
|
||||
|
||||
void _deserializeProperties(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
required List<Object?> serializedList,
|
||||
required CatBuilder result,
|
||||
required List<Object?> unhandled,
|
||||
}) {
|
||||
for (var i = 0; i < serializedList.length; i += 2) {
|
||||
final key = serializedList[i] as String;
|
||||
final value = serializedList[i + 1];
|
||||
switch (key) {
|
||||
case r'declawed':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(bool),
|
||||
) as bool;
|
||||
result.declawed = valueDes;
|
||||
break;
|
||||
default:
|
||||
unhandled.add(key);
|
||||
unhandled.add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Cat deserialize(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
final result = CatBuilder();
|
||||
final serializedList = (serialized as Iterable<Object?>).toList();
|
||||
final unhandled = <Object?>[];
|
||||
_deserializeProperties(
|
||||
serializers,
|
||||
serialized,
|
||||
specifiedType: specifiedType,
|
||||
serializedList: serializedList,
|
||||
unhandled: unhandled,
|
||||
result: result,
|
||||
);
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,108 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
// ignore_for_file: unused_element
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'dog.g.dart';
|
||||
|
||||
/// Dog
|
||||
///
|
||||
/// Properties:
|
||||
/// * [bark]
|
||||
@BuiltValue()
|
||||
abstract class Dog implements Built<Dog, DogBuilder> {
|
||||
@BuiltValueField(wireName: r'bark')
|
||||
bool? get bark;
|
||||
|
||||
Dog._();
|
||||
|
||||
factory Dog([void updates(DogBuilder b)]) = _$Dog;
|
||||
|
||||
@BuiltValueHook(initializeBuilder: true)
|
||||
static void _defaults(DogBuilder b) => b;
|
||||
|
||||
@BuiltValueSerializer(custom: true)
|
||||
static Serializer<Dog> get serializer => _$DogSerializer();
|
||||
}
|
||||
|
||||
class _$DogSerializer implements PrimitiveSerializer<Dog> {
|
||||
@override
|
||||
final Iterable<Type> types = const [Dog, _$Dog];
|
||||
|
||||
@override
|
||||
final String wireName = r'Dog';
|
||||
|
||||
Iterable<Object?> _serializeProperties(
|
||||
Serializers serializers,
|
||||
Dog object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) sync* {
|
||||
if (object.bark != null) {
|
||||
yield r'bark';
|
||||
yield serializers.serialize(
|
||||
object.bark,
|
||||
specifiedType: const FullType(bool),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Object serialize(
|
||||
Serializers serializers,
|
||||
Dog object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
|
||||
}
|
||||
|
||||
void _deserializeProperties(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
required List<Object?> serializedList,
|
||||
required DogBuilder result,
|
||||
required List<Object?> unhandled,
|
||||
}) {
|
||||
for (var i = 0; i < serializedList.length; i += 2) {
|
||||
final key = serializedList[i] as String;
|
||||
final value = serializedList[i + 1];
|
||||
switch (key) {
|
||||
case r'bark':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(bool),
|
||||
) as bool;
|
||||
result.bark = valueDes;
|
||||
break;
|
||||
default:
|
||||
unhandled.add(key);
|
||||
unhandled.add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Dog deserialize(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
final result = DogBuilder();
|
||||
final serializedList = (serialized as Iterable<Object?>).toList();
|
||||
final unhandled = <Object?>[];
|
||||
_deserializeProperties(
|
||||
serializers,
|
||||
serialized,
|
||||
specifiedType: specifiedType,
|
||||
serializedList: serializedList,
|
||||
unhandled: unhandled,
|
||||
result: result,
|
||||
);
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
@ -15,12 +15,15 @@ import 'package:openapi/src/date_serializer.dart';
|
||||
import 'package:openapi/src/model/date.dart';
|
||||
|
||||
import 'package:openapi/src/model/addressable.dart';
|
||||
import 'package:openapi/src/model/animal.dart';
|
||||
import 'package:openapi/src/model/apple.dart';
|
||||
import 'package:openapi/src/model/banana.dart';
|
||||
import 'package:openapi/src/model/bar.dart';
|
||||
import 'package:openapi/src/model/bar_create.dart';
|
||||
import 'package:openapi/src/model/bar_ref.dart';
|
||||
import 'package:openapi/src/model/bar_ref_or_value.dart';
|
||||
import 'package:openapi/src/model/cat.dart';
|
||||
import 'package:openapi/src/model/dog.dart';
|
||||
import 'package:openapi/src/model/entity.dart';
|
||||
import 'package:openapi/src/model/entity_ref.dart';
|
||||
import 'package:openapi/src/model/extensible.dart';
|
||||
@ -37,12 +40,15 @@ part 'serializers.g.dart';
|
||||
|
||||
@SerializersFor([
|
||||
Addressable,$Addressable,
|
||||
Animal,
|
||||
Apple,
|
||||
Banana,
|
||||
Bar,
|
||||
BarCreate,
|
||||
BarRef,
|
||||
BarRefOrValue,
|
||||
Cat,
|
||||
Dog,
|
||||
Entity,$Entity,
|
||||
EntityRef,$EntityRef,
|
||||
Extensible,$Extensible,
|
||||
|
@ -0,0 +1,21 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
// tests for Animal
|
||||
void main() {
|
||||
final instance = AnimalBuilder();
|
||||
// TODO add properties to the builder and call build()
|
||||
|
||||
group(Animal, () {
|
||||
// bool bark
|
||||
test('to test the property `bark`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// bool declawed
|
||||
test('to test the property `declawed`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
// tests for Cat
|
||||
void main() {
|
||||
final instance = CatBuilder();
|
||||
// TODO add properties to the builder and call build()
|
||||
|
||||
group(Cat, () {
|
||||
// bool declawed
|
||||
test('to test the property `declawed`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
// tests for Dog
|
||||
void main() {
|
||||
final instance = DogBuilder();
|
||||
// TODO add properties to the builder and call build()
|
||||
|
||||
group(Dog, () {
|
||||
// bool bark
|
||||
test('to test the property `bark`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
});
|
||||
}
|
@ -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
|
@ -0,0 +1,34 @@
|
||||
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/FooApi.java
|
||||
src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java
|
||||
src/main/java/org/openapitools/configuration/HomeController.java
|
||||
src/main/java/org/openapitools/configuration/SpringDocConfiguration.java
|
||||
src/main/java/org/openapitools/model/Addressable.java
|
||||
src/main/java/org/openapitools/model/Animal.java
|
||||
src/main/java/org/openapitools/model/Apple.java
|
||||
src/main/java/org/openapitools/model/Banana.java
|
||||
src/main/java/org/openapitools/model/Bar.java
|
||||
src/main/java/org/openapitools/model/BarCreate.java
|
||||
src/main/java/org/openapitools/model/BarRef.java
|
||||
src/main/java/org/openapitools/model/BarRefOrValue.java
|
||||
src/main/java/org/openapitools/model/Cat.java
|
||||
src/main/java/org/openapitools/model/Dog.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/java/org/openapitools/model/Fruit.java
|
||||
src/main/java/org/openapitools/model/FruitType.java
|
||||
src/main/java/org/openapitools/model/Pasta.java
|
||||
src/main/java/org/openapitools/model/Pizza.java
|
||||
src/main/java/org/openapitools/model/PizzaSpeziale.java
|
||||
src/main/resources/application.properties
|
||||
src/main/resources/openapi.yaml
|
||||
src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java
|
@ -0,0 +1 @@
|
||||
7.15.0-SNAPSHOT
|
@ -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
|
@ -0,0 +1,82 @@
|
||||
<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>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<springdoc.version>1.6.14</springdoc.version>
|
||||
<swagger-ui.version>5.3.1</swagger-ui.version>
|
||||
</properties>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.15</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
</configuration>
|
||||
</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.6</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>
|
@ -0,0 +1,30 @@
|
||||
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;
|
||||
import org.springframework.context.annotation.FilterType;
|
||||
import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator;
|
||||
|
||||
@SpringBootApplication(
|
||||
nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class
|
||||
)
|
||||
@ComponentScan(
|
||||
basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"},
|
||||
nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class
|
||||
)
|
||||
public class OpenApiGeneratorApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(OpenApiGeneratorApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean(name = "org.openapitools.OpenApiGeneratorApplication.jsonNullableModule")
|
||||
public Module jsonNullableModule() {
|
||||
return new JsonNullableModule();
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.15.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.ExternalDocumentation;
|
||||
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.ArraySchema;
|
||||
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 io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.lang.Nullable;
|
||||
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", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
@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 = "{ \"foo\" : { \"fooPropA\" : \"fooPropA\", \"fooPropB\" : \"fooPropB\" }, \"id\" : \"id\", \"fooPropB\" : \"fooPropB\", \"barPropA\" : \"barPropA\" }";
|
||||
ApiUtil.setExampleResponse(request, "application/json", exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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", comments = "Generator version: 7.13.0-SNAPSHOT")
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.15.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.ExternalDocumentation;
|
||||
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.ArraySchema;
|
||||
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 io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.lang.Nullable;
|
||||
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", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
@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) @Nullable Foo foo
|
||||
) {
|
||||
getRequest().ifPresent(request -> {
|
||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"fooPropA\" : \"fooPropA\", \"fooPropB\" : \"fooPropB\" }";
|
||||
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", array = @ArraySchema(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 = "[ { \"fooPropA\" : \"fooPropA\", \"fooPropB\" : \"fooPropB\" }, { \"fooPropA\" : \"fooPropA\", \"fooPropB\" : \"fooPropB\" } ]";
|
||||
ApiUtil.setExampleResponse(request, "application/json;charset=utf-8", exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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", comments = "Generator version: 7.13.0-SNAPSHOT")
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package org.openapitools.configuration;
|
||||
|
||||
import org.openapitools.model.FruitType;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration")
|
||||
public class EnumConverterConfiguration {
|
||||
|
||||
@Bean(name = "org.openapitools.configuration.EnumConverterConfiguration.fruitTypeConverter")
|
||||
Converter<String, FruitType> fruitTypeConverter() {
|
||||
return new Converter<String, FruitType>() {
|
||||
@Override
|
||||
public FruitType convert(String source) {
|
||||
return FruitType.fromValue(source);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package org.openapitools.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.info.Contact;
|
||||
import io.swagger.v3.oas.models.info.License;
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
|
||||
@Configuration
|
||||
public class SpringDocConfiguration {
|
||||
|
||||
@Bean(name = "org.openapitools.configuration.SpringDocConfiguration.apiInfo")
|
||||
OpenAPI apiInfo() {
|
||||
return new OpenAPI()
|
||||
.info(
|
||||
new Info()
|
||||
.title("ByRefOrValue")
|
||||
.description("This tests for a oneOf interface representation ")
|
||||
.version("0.0.1")
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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 addressable entities
|
||||
*/
|
||||
|
||||
@Schema(name = "Addressable", description = "Base schema for addressable entities")
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Addressable {
|
||||
|
||||
private @Nullable String href;
|
||||
|
||||
private @Nullable String id;
|
||||
|
||||
public Addressable href(@Nullable String href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hyperlink reference
|
||||
* @return href
|
||||
*/
|
||||
|
||||
@Schema(name = "href", description = "Hyperlink reference", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("href")
|
||||
public @Nullable String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
public void setHref(@Nullable String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public Addressable id(@Nullable String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* unique identifier
|
||||
* @return id
|
||||
*/
|
||||
|
||||
@Schema(name = "id", description = "unique identifier", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("id")
|
||||
public @Nullable String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(@Nullable 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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
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.model.Cat;
|
||||
import org.openapitools.model.Dog;
|
||||
import org.springframework.lang.Nullable;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
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;
|
||||
|
||||
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value = Dog.class),
|
||||
@JsonSubTypes.Type(value = Cat.class)
|
||||
})
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public interface Animal {
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
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.springframework.lang.Nullable;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Apple
|
||||
*/
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Apple implements Fruit {
|
||||
|
||||
private Integer seeds;
|
||||
|
||||
private FruitType fruitType;
|
||||
|
||||
public Apple() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public Apple(Integer seeds) {
|
||||
this.seeds = seeds;
|
||||
this.fruitType = fruitType;
|
||||
}
|
||||
|
||||
public Apple seeds(Integer seeds) {
|
||||
this.seeds = seeds;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get seeds
|
||||
* @return seeds
|
||||
*/
|
||||
@NotNull
|
||||
@Schema(name = "seeds", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("seeds")
|
||||
public Integer getSeeds() {
|
||||
return seeds;
|
||||
}
|
||||
|
||||
public void setSeeds(Integer seeds) {
|
||||
this.seeds = seeds;
|
||||
}
|
||||
|
||||
public Apple fruitType(FruitType fruitType) {
|
||||
this.fruitType = fruitType;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fruitType
|
||||
* @return fruitType
|
||||
*/
|
||||
@NotNull @Valid
|
||||
@Schema(name = "fruitType", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("fruitType")
|
||||
public FruitType getFruitType() {
|
||||
return fruitType;
|
||||
}
|
||||
|
||||
public void setFruitType(FruitType fruitType) {
|
||||
this.fruitType = fruitType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Apple apple = (Apple) o;
|
||||
return Objects.equals(this.seeds, apple.seeds) &&
|
||||
Objects.equals(this.fruitType, apple.fruitType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(seeds, fruitType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Apple {\n");
|
||||
sb.append(" seeds: ").append(toIndentedString(seeds)).append("\n");
|
||||
sb.append(" fruitType: ").append(toIndentedString(fruitType)).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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,124 @@
|
||||
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.springframework.lang.Nullable;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Banana
|
||||
*/
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Banana implements Fruit {
|
||||
|
||||
private Integer length;
|
||||
|
||||
private FruitType fruitType;
|
||||
|
||||
public Banana() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public Banana(Integer length) {
|
||||
this.length = length;
|
||||
this.fruitType = fruitType;
|
||||
}
|
||||
|
||||
public Banana length(Integer length) {
|
||||
this.length = length;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get length
|
||||
* @return length
|
||||
*/
|
||||
@NotNull
|
||||
@Schema(name = "length", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("length")
|
||||
public Integer getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(Integer length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public Banana fruitType(FruitType fruitType) {
|
||||
this.fruitType = fruitType;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fruitType
|
||||
* @return fruitType
|
||||
*/
|
||||
@NotNull @Valid
|
||||
@Schema(name = "fruitType", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("fruitType")
|
||||
public FruitType getFruitType() {
|
||||
return fruitType;
|
||||
}
|
||||
|
||||
public void setFruitType(FruitType fruitType) {
|
||||
this.fruitType = fruitType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Banana banana = (Banana) o;
|
||||
return Objects.equals(this.length, banana.length) &&
|
||||
Objects.equals(this.fruitType, banana.fruitType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(length, fruitType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Banana {\n");
|
||||
sb.append(" length: ").append(toIndentedString(length)).append("\n");
|
||||
sb.append(" fruitType: ").append(toIndentedString(fruitType)).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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,196 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Bar extends Entity implements BarRefOrValue {
|
||||
|
||||
private String id;
|
||||
|
||||
private @Nullable String barPropA;
|
||||
|
||||
private @Nullable String fooPropB;
|
||||
|
||||
private @Nullable FooRefOrValue foo;
|
||||
|
||||
public Bar() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public Bar(String id, String atType) {
|
||||
super(atType);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Bar id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
*/
|
||||
@NotNull
|
||||
@Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Bar barPropA(@Nullable String barPropA) {
|
||||
this.barPropA = barPropA;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get barPropA
|
||||
* @return barPropA
|
||||
*/
|
||||
|
||||
@Schema(name = "barPropA", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("barPropA")
|
||||
public @Nullable String getBarPropA() {
|
||||
return barPropA;
|
||||
}
|
||||
|
||||
public void setBarPropA(@Nullable String barPropA) {
|
||||
this.barPropA = barPropA;
|
||||
}
|
||||
|
||||
public Bar fooPropB(@Nullable String fooPropB) {
|
||||
this.fooPropB = fooPropB;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fooPropB
|
||||
* @return fooPropB
|
||||
*/
|
||||
|
||||
@Schema(name = "fooPropB", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("fooPropB")
|
||||
public @Nullable String getFooPropB() {
|
||||
return fooPropB;
|
||||
}
|
||||
|
||||
public void setFooPropB(@Nullable String fooPropB) {
|
||||
this.fooPropB = fooPropB;
|
||||
}
|
||||
|
||||
public Bar foo(@Nullable FooRefOrValue foo) {
|
||||
this.foo = foo;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get foo
|
||||
* @return foo
|
||||
*/
|
||||
@Valid
|
||||
@Schema(name = "foo", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("foo")
|
||||
public @Nullable FooRefOrValue getFoo() {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void setFoo(@Nullable FooRefOrValue foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
|
||||
public Bar href(String href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Bar atSchemaLocation(String atSchemaLocation) {
|
||||
super.atSchemaLocation(atSchemaLocation);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Bar atBaseType(String atBaseType) {
|
||||
super.atBaseType(atBaseType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Bar atType(String atType) {
|
||||
super.atType(atType);
|
||||
return this;
|
||||
}
|
||||
@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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,178 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class BarCreate extends Entity {
|
||||
|
||||
private @Nullable String barPropA;
|
||||
|
||||
private @Nullable String fooPropB;
|
||||
|
||||
private @Nullable FooRefOrValue foo;
|
||||
|
||||
public BarCreate() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public BarCreate(String atType) {
|
||||
super(atType);
|
||||
}
|
||||
|
||||
public BarCreate barPropA(@Nullable String barPropA) {
|
||||
this.barPropA = barPropA;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get barPropA
|
||||
* @return barPropA
|
||||
*/
|
||||
|
||||
@Schema(name = "barPropA", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("barPropA")
|
||||
public @Nullable String getBarPropA() {
|
||||
return barPropA;
|
||||
}
|
||||
|
||||
public void setBarPropA(@Nullable String barPropA) {
|
||||
this.barPropA = barPropA;
|
||||
}
|
||||
|
||||
public BarCreate fooPropB(@Nullable String fooPropB) {
|
||||
this.fooPropB = fooPropB;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fooPropB
|
||||
* @return fooPropB
|
||||
*/
|
||||
|
||||
@Schema(name = "fooPropB", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("fooPropB")
|
||||
public @Nullable String getFooPropB() {
|
||||
return fooPropB;
|
||||
}
|
||||
|
||||
public void setFooPropB(@Nullable String fooPropB) {
|
||||
this.fooPropB = fooPropB;
|
||||
}
|
||||
|
||||
public BarCreate foo(@Nullable FooRefOrValue foo) {
|
||||
this.foo = foo;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get foo
|
||||
* @return foo
|
||||
*/
|
||||
@Valid
|
||||
@Schema(name = "foo", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("foo")
|
||||
public @Nullable FooRefOrValue getFoo() {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void setFoo(@Nullable FooRefOrValue foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
|
||||
public BarCreate href(String href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BarCreate id(String id) {
|
||||
super.id(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BarCreate atSchemaLocation(String atSchemaLocation) {
|
||||
super.atSchemaLocation(atSchemaLocation);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BarCreate atBaseType(String atBaseType) {
|
||||
super.atBaseType(atBaseType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BarCreate atType(String atType) {
|
||||
super.atType(atType);
|
||||
return this;
|
||||
}
|
||||
@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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,112 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* BarRef
|
||||
*/
|
||||
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class BarRef extends EntityRef implements BarRefOrValue {
|
||||
|
||||
public BarRef() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public BarRef(String atType) {
|
||||
super(atType);
|
||||
}
|
||||
|
||||
|
||||
public BarRef name(String name) {
|
||||
super.name(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BarRef atReferredType(String atReferredType) {
|
||||
super.atReferredType(atReferredType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BarRef href(String href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BarRef id(String id) {
|
||||
super.id(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BarRef atSchemaLocation(String atSchemaLocation) {
|
||||
super.atSchemaLocation(atSchemaLocation);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BarRef atBaseType(String atBaseType) {
|
||||
super.atBaseType(atBaseType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BarRef atType(String atType) {
|
||||
super.atType(atType);
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class BarRef {\n");
|
||||
sb.append(" ").append(toIndentedString(super.toString())).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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
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.Bar;
|
||||
import org.openapitools.model.BarRef;
|
||||
import org.openapitools.model.FooRefOrValue;
|
||||
import org.springframework.lang.Nullable;
|
||||
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 = Bar.class, name = "Bar"),
|
||||
@JsonSubTypes.Type(value = BarRef.class, name = "BarRef")
|
||||
})
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public interface BarRefOrValue {
|
||||
public String getAtType();
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Cat
|
||||
*/
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Cat implements Animal {
|
||||
|
||||
private @Nullable Boolean declawed;
|
||||
|
||||
public Cat declawed(@Nullable Boolean declawed) {
|
||||
this.declawed = declawed;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get declawed
|
||||
* @return declawed
|
||||
*/
|
||||
|
||||
@Schema(name = "declawed", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("declawed")
|
||||
public @Nullable Boolean getDeclawed() {
|
||||
return declawed;
|
||||
}
|
||||
|
||||
public void setDeclawed(@Nullable Boolean declawed) {
|
||||
this.declawed = declawed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Cat cat = (Cat) o;
|
||||
return Objects.equals(this.declawed, cat.declawed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(declawed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Cat {\n");
|
||||
sb.append(" declawed: ").append(toIndentedString(declawed)).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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,84 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Dog
|
||||
*/
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Dog implements Animal {
|
||||
|
||||
private @Nullable Boolean bark;
|
||||
|
||||
public Dog bark(@Nullable Boolean bark) {
|
||||
this.bark = bark;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bark
|
||||
* @return bark
|
||||
*/
|
||||
|
||||
@Schema(name = "bark", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("bark")
|
||||
public @Nullable Boolean getBark() {
|
||||
return bark;
|
||||
}
|
||||
|
||||
public void setBark(@Nullable Boolean bark) {
|
||||
this.bark = bark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Dog dog = (Dog) o;
|
||||
return Objects.equals(this.bark, dog.bark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(bark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Dog {\n");
|
||||
sb.append(" bark: ").append(toIndentedString(bark)).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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,208 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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"),
|
||||
@JsonSubTypes.Type(value = Pasta.class, name = "Pasta"),
|
||||
@JsonSubTypes.Type(value = Pizza.class, name = "Pizza"),
|
||||
@JsonSubTypes.Type(value = PizzaSpeziale.class, name = "PizzaSpeziale")
|
||||
})
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Entity {
|
||||
|
||||
private @Nullable String href;
|
||||
|
||||
private @Nullable String id;
|
||||
|
||||
private @Nullable String atSchemaLocation;
|
||||
|
||||
private @Nullable String atBaseType;
|
||||
|
||||
private String atType;
|
||||
|
||||
public Entity() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public Entity(String atType) {
|
||||
this.atType = atType;
|
||||
}
|
||||
|
||||
public Entity href(@Nullable String href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hyperlink reference
|
||||
* @return href
|
||||
*/
|
||||
|
||||
@Schema(name = "href", description = "Hyperlink reference", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("href")
|
||||
public @Nullable String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
public void setHref(@Nullable String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public Entity id(@Nullable String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* unique identifier
|
||||
* @return id
|
||||
*/
|
||||
|
||||
@Schema(name = "id", description = "unique identifier", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("id")
|
||||
public @Nullable String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(@Nullable String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Entity atSchemaLocation(@Nullable 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", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("@schemaLocation")
|
||||
public @Nullable String getAtSchemaLocation() {
|
||||
return atSchemaLocation;
|
||||
}
|
||||
|
||||
public void setAtSchemaLocation(@Nullable String atSchemaLocation) {
|
||||
this.atSchemaLocation = atSchemaLocation;
|
||||
}
|
||||
|
||||
public Entity atBaseType(@Nullable 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", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("@baseType")
|
||||
public @Nullable String getAtBaseType() {
|
||||
return atBaseType;
|
||||
}
|
||||
|
||||
public void setAtBaseType(@Nullable 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", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("@type")
|
||||
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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,253 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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 = BarRef.class, name = "BarRef"),
|
||||
@JsonSubTypes.Type(value = FooRef.class, name = "FooRef")
|
||||
})
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class EntityRef {
|
||||
|
||||
private @Nullable String name;
|
||||
|
||||
private @Nullable String atReferredType;
|
||||
|
||||
private @Nullable String href;
|
||||
|
||||
private @Nullable String id;
|
||||
|
||||
private @Nullable String atSchemaLocation;
|
||||
|
||||
private @Nullable String atBaseType;
|
||||
|
||||
private String atType;
|
||||
|
||||
public EntityRef() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public EntityRef(String atType) {
|
||||
this.atType = atType;
|
||||
}
|
||||
|
||||
public EntityRef name(@Nullable String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the related entity.
|
||||
* @return name
|
||||
*/
|
||||
|
||||
@Schema(name = "name", description = "Name of the related entity.", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("name")
|
||||
public @Nullable String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(@Nullable String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public EntityRef atReferredType(@Nullable 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.", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("@referredType")
|
||||
public @Nullable String getAtReferredType() {
|
||||
return atReferredType;
|
||||
}
|
||||
|
||||
public void setAtReferredType(@Nullable String atReferredType) {
|
||||
this.atReferredType = atReferredType;
|
||||
}
|
||||
|
||||
public EntityRef href(@Nullable String href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hyperlink reference
|
||||
* @return href
|
||||
*/
|
||||
|
||||
@Schema(name = "href", description = "Hyperlink reference", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("href")
|
||||
public @Nullable String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
public void setHref(@Nullable String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public EntityRef id(@Nullable String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* unique identifier
|
||||
* @return id
|
||||
*/
|
||||
|
||||
@Schema(name = "id", description = "unique identifier", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("id")
|
||||
public @Nullable String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(@Nullable String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public EntityRef atSchemaLocation(@Nullable 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", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("@schemaLocation")
|
||||
public @Nullable String getAtSchemaLocation() {
|
||||
return atSchemaLocation;
|
||||
}
|
||||
|
||||
public void setAtSchemaLocation(@Nullable String atSchemaLocation) {
|
||||
this.atSchemaLocation = atSchemaLocation;
|
||||
}
|
||||
|
||||
public EntityRef atBaseType(@Nullable 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", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("@baseType")
|
||||
public @Nullable String getAtBaseType() {
|
||||
return atBaseType;
|
||||
}
|
||||
|
||||
public void setAtBaseType(@Nullable 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", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("@type")
|
||||
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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,143 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Extensible {
|
||||
|
||||
private @Nullable String atSchemaLocation;
|
||||
|
||||
private @Nullable String atBaseType;
|
||||
|
||||
private String atType;
|
||||
|
||||
public Extensible() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public Extensible(String atType) {
|
||||
this.atType = atType;
|
||||
}
|
||||
|
||||
public Extensible atSchemaLocation(@Nullable 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", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("@schemaLocation")
|
||||
public @Nullable String getAtSchemaLocation() {
|
||||
return atSchemaLocation;
|
||||
}
|
||||
|
||||
public void setAtSchemaLocation(@Nullable String atSchemaLocation) {
|
||||
this.atSchemaLocation = atSchemaLocation;
|
||||
}
|
||||
|
||||
public Extensible atBaseType(@Nullable 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", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("@baseType")
|
||||
public @Nullable String getAtBaseType() {
|
||||
return atBaseType;
|
||||
}
|
||||
|
||||
public void setAtBaseType(@Nullable 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", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonProperty("@type")
|
||||
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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,151 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Foo extends Entity implements FooRefOrValue {
|
||||
|
||||
private @Nullable String fooPropA;
|
||||
|
||||
private @Nullable String fooPropB;
|
||||
|
||||
public Foo() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public Foo(String atType) {
|
||||
super(atType);
|
||||
}
|
||||
|
||||
public Foo fooPropA(@Nullable String fooPropA) {
|
||||
this.fooPropA = fooPropA;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fooPropA
|
||||
* @return fooPropA
|
||||
*/
|
||||
|
||||
@Schema(name = "fooPropA", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("fooPropA")
|
||||
public @Nullable String getFooPropA() {
|
||||
return fooPropA;
|
||||
}
|
||||
|
||||
public void setFooPropA(@Nullable String fooPropA) {
|
||||
this.fooPropA = fooPropA;
|
||||
}
|
||||
|
||||
public Foo fooPropB(@Nullable String fooPropB) {
|
||||
this.fooPropB = fooPropB;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fooPropB
|
||||
* @return fooPropB
|
||||
*/
|
||||
|
||||
@Schema(name = "fooPropB", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("fooPropB")
|
||||
public @Nullable String getFooPropB() {
|
||||
return fooPropB;
|
||||
}
|
||||
|
||||
public void setFooPropB(@Nullable String fooPropB) {
|
||||
this.fooPropB = fooPropB;
|
||||
}
|
||||
|
||||
|
||||
public Foo href(String href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Foo id(String id) {
|
||||
super.id(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Foo atSchemaLocation(String atSchemaLocation) {
|
||||
super.atSchemaLocation(atSchemaLocation);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Foo atBaseType(String atBaseType) {
|
||||
super.atBaseType(atBaseType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Foo atType(String atType) {
|
||||
super.atType(atType);
|
||||
return this;
|
||||
}
|
||||
@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) &&
|
||||
super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(fooPropA, fooPropB, 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("}");
|
||||
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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,137 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class FooRef extends EntityRef implements FooRefOrValue {
|
||||
|
||||
private @Nullable String foorefPropA;
|
||||
|
||||
public FooRef() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public FooRef(String atType) {
|
||||
super(atType);
|
||||
}
|
||||
|
||||
public FooRef foorefPropA(@Nullable String foorefPropA) {
|
||||
this.foorefPropA = foorefPropA;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get foorefPropA
|
||||
* @return foorefPropA
|
||||
*/
|
||||
|
||||
@Schema(name = "foorefPropA", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("foorefPropA")
|
||||
public @Nullable String getFoorefPropA() {
|
||||
return foorefPropA;
|
||||
}
|
||||
|
||||
public void setFoorefPropA(@Nullable String foorefPropA) {
|
||||
this.foorefPropA = foorefPropA;
|
||||
}
|
||||
|
||||
|
||||
public FooRef name(String name) {
|
||||
super.name(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FooRef atReferredType(String atReferredType) {
|
||||
super.atReferredType(atReferredType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FooRef href(String href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FooRef id(String id) {
|
||||
super.id(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FooRef atSchemaLocation(String atSchemaLocation) {
|
||||
super.atSchemaLocation(atSchemaLocation);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FooRef atBaseType(String atBaseType) {
|
||||
super.atBaseType(atBaseType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FooRef atType(String atType) {
|
||||
super.atType(atType);
|
||||
return this;
|
||||
}
|
||||
@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) &&
|
||||
super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(foorefPropA, 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("}");
|
||||
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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public interface FooRefOrValue {
|
||||
public String getAtType();
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
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.Apple;
|
||||
import org.openapitools.model.Banana;
|
||||
import org.openapitools.model.FruitType;
|
||||
import org.springframework.lang.Nullable;
|
||||
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 = "fruitType", // ignore manually set fruitType, it will be automatically generated by Jackson during serialization
|
||||
allowSetters = true // allows the fruitType to be set during deserialization
|
||||
)
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fruitType", visible = true)
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value = Apple.class, name = "APPLE"),
|
||||
@JsonSubTypes.Type(value = Banana.class, name = "BANANA")
|
||||
})
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public interface Fruit {
|
||||
public FruitType getFruitType();
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package org.openapitools.model;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
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;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* Gets or Sets FruitType
|
||||
*/
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public enum FruitType {
|
||||
|
||||
APPLE("APPLE"),
|
||||
|
||||
BANANA("BANANA");
|
||||
|
||||
private final String value;
|
||||
|
||||
FruitType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static FruitType fromValue(String value) {
|
||||
for (FruitType b : FruitType.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,127 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Pasta
|
||||
*/
|
||||
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Pasta extends Entity {
|
||||
|
||||
private @Nullable String vendor;
|
||||
|
||||
public Pasta() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public Pasta(String atType) {
|
||||
super(atType);
|
||||
}
|
||||
|
||||
public Pasta vendor(@Nullable String vendor) {
|
||||
this.vendor = vendor;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get vendor
|
||||
* @return vendor
|
||||
*/
|
||||
|
||||
@Schema(name = "vendor", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("vendor")
|
||||
public @Nullable String getVendor() {
|
||||
return vendor;
|
||||
}
|
||||
|
||||
public void setVendor(@Nullable String vendor) {
|
||||
this.vendor = vendor;
|
||||
}
|
||||
|
||||
|
||||
public Pasta href(String href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pasta id(String id) {
|
||||
super.id(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pasta atSchemaLocation(String atSchemaLocation) {
|
||||
super.atSchemaLocation(atSchemaLocation);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pasta atBaseType(String atBaseType) {
|
||||
super.atBaseType(atBaseType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pasta atType(String atType) {
|
||||
super.atType(atType);
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Pasta pasta = (Pasta) o;
|
||||
return Objects.equals(this.vendor, pasta.vendor) &&
|
||||
super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(vendor, super.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Pasta {\n");
|
||||
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
||||
sb.append(" vendor: ").append(toIndentedString(vendor)).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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,136 @@
|
||||
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 java.math.BigDecimal;
|
||||
import org.openapitools.model.Entity;
|
||||
import org.springframework.lang.Nullable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Pizza
|
||||
*/
|
||||
|
||||
@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 = PizzaSpeziale.class, name = "PizzaSpeziale")
|
||||
})
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Pizza extends Entity {
|
||||
|
||||
private @Nullable BigDecimal pizzaSize;
|
||||
|
||||
public Pizza() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public Pizza(String atType) {
|
||||
super(atType);
|
||||
}
|
||||
|
||||
public Pizza pizzaSize(@Nullable BigDecimal pizzaSize) {
|
||||
this.pizzaSize = pizzaSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pizzaSize
|
||||
* @return pizzaSize
|
||||
*/
|
||||
@Valid
|
||||
@Schema(name = "pizzaSize", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("pizzaSize")
|
||||
public @Nullable BigDecimal getPizzaSize() {
|
||||
return pizzaSize;
|
||||
}
|
||||
|
||||
public void setPizzaSize(@Nullable BigDecimal pizzaSize) {
|
||||
this.pizzaSize = pizzaSize;
|
||||
}
|
||||
|
||||
|
||||
public Pizza href(String href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pizza id(String id) {
|
||||
super.id(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pizza atSchemaLocation(String atSchemaLocation) {
|
||||
super.atSchemaLocation(atSchemaLocation);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pizza atBaseType(String atBaseType) {
|
||||
super.atBaseType(atBaseType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pizza atType(String atType) {
|
||||
super.atType(atType);
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Pizza pizza = (Pizza) o;
|
||||
return Objects.equals(this.pizzaSize, pizza.pizzaSize) &&
|
||||
super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(pizzaSize, super.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Pizza {\n");
|
||||
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
||||
sb.append(" pizzaSize: ").append(toIndentedString(pizzaSize)).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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,133 @@
|
||||
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 java.math.BigDecimal;
|
||||
import org.openapitools.model.Pizza;
|
||||
import org.springframework.lang.Nullable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* PizzaSpeziale
|
||||
*/
|
||||
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class PizzaSpeziale extends Pizza {
|
||||
|
||||
private @Nullable String toppings;
|
||||
|
||||
public PizzaSpeziale() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with only required parameters
|
||||
*/
|
||||
public PizzaSpeziale(String atType) {
|
||||
super(atType);
|
||||
}
|
||||
|
||||
public PizzaSpeziale toppings(@Nullable String toppings) {
|
||||
this.toppings = toppings;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get toppings
|
||||
* @return toppings
|
||||
*/
|
||||
|
||||
@Schema(name = "toppings", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("toppings")
|
||||
public @Nullable String getToppings() {
|
||||
return toppings;
|
||||
}
|
||||
|
||||
public void setToppings(@Nullable String toppings) {
|
||||
this.toppings = toppings;
|
||||
}
|
||||
|
||||
|
||||
public PizzaSpeziale pizzaSize(BigDecimal pizzaSize) {
|
||||
super.pizzaSize(pizzaSize);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PizzaSpeziale href(String href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PizzaSpeziale id(String id) {
|
||||
super.id(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PizzaSpeziale atSchemaLocation(String atSchemaLocation) {
|
||||
super.atSchemaLocation(atSchemaLocation);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PizzaSpeziale atBaseType(String atBaseType) {
|
||||
super.atBaseType(atBaseType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PizzaSpeziale atType(String atType) {
|
||||
super.atType(atType);
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
PizzaSpeziale pizzaSpeziale = (PizzaSpeziale) o;
|
||||
return Objects.equals(this.toppings, pizzaSpeziale.toppings) &&
|
||||
super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(toppings, super.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class PizzaSpeziale {\n");
|
||||
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
||||
sb.append(" toppings: ").append(toIndentedString(toppings)).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 ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,3 @@
|
||||
server.port=8080
|
||||
spring.jackson.date-format=org.openapitools.RFC3339DateFormat
|
||||
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
|
@ -0,0 +1,279 @@
|
||||
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":
|
||||
$ref: "#/components/responses/200FooArray"
|
||||
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":
|
||||
$ref: "#/components/responses/201Foo"
|
||||
summary: Create a Foo
|
||||
tags:
|
||||
- Foo
|
||||
x-content-type: 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-content-type: 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 addressable 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"
|
||||
properties:
|
||||
foorefPropA:
|
||||
type: string
|
||||
type: object
|
||||
BarRef:
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/EntityRef"
|
||||
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:
|
||||
fooPropA: fooPropA
|
||||
fooPropB: fooPropB
|
||||
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
|
||||
BarRefOrValue:
|
||||
oneOf:
|
||||
- $ref: "#/components/schemas/Bar"
|
||||
- $ref: "#/components/schemas/BarRef"
|
||||
type: object
|
||||
x-one-of-name: BarRefOrValue
|
||||
Pizza:
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/Entity"
|
||||
properties:
|
||||
pizzaSize:
|
||||
type: number
|
||||
type: object
|
||||
Pasta:
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/Entity"
|
||||
properties:
|
||||
vendor:
|
||||
type: string
|
||||
type: object
|
||||
PizzaSpeziale:
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/Pizza"
|
||||
properties:
|
||||
toppings:
|
||||
type: string
|
||||
type: object
|
||||
FruitType:
|
||||
enum:
|
||||
- APPLE
|
||||
- BANANA
|
||||
type: string
|
||||
Fruit:
|
||||
discriminator:
|
||||
mapping:
|
||||
APPLE: "#/components/schemas/Apple"
|
||||
BANANA: "#/components/schemas/Banana"
|
||||
propertyName: fruitType
|
||||
oneOf:
|
||||
- $ref: "#/components/schemas/Apple"
|
||||
- $ref: "#/components/schemas/Banana"
|
||||
properties:
|
||||
fruitType:
|
||||
$ref: "#/components/schemas/FruitType"
|
||||
required:
|
||||
- fruitType
|
||||
type: object
|
||||
x-one-of-name: Fruit
|
||||
Apple:
|
||||
properties:
|
||||
seeds:
|
||||
type: integer
|
||||
required:
|
||||
- seeds
|
||||
type: object
|
||||
Banana:
|
||||
properties:
|
||||
length:
|
||||
type: integer
|
||||
required:
|
||||
- length
|
||||
type: object
|
||||
Animal:
|
||||
oneOf:
|
||||
- $ref: "#/components/schemas/Dog"
|
||||
- $ref: "#/components/schemas/Cat"
|
||||
x-one-of-name: Animal
|
||||
Cat:
|
||||
properties:
|
||||
declawed:
|
||||
type: boolean
|
||||
type: object
|
||||
Dog:
|
||||
properties:
|
||||
bark:
|
||||
type: boolean
|
||||
type: object
|
@ -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() {
|
||||
}
|
||||
|
||||
}
|
@ -9,12 +9,15 @@ src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java
|
||||
src/main/java/org/openapitools/configuration/HomeController.java
|
||||
src/main/java/org/openapitools/configuration/SpringDocConfiguration.java
|
||||
src/main/java/org/openapitools/model/Addressable.java
|
||||
src/main/java/org/openapitools/model/Animal.java
|
||||
src/main/java/org/openapitools/model/Apple.java
|
||||
src/main/java/org/openapitools/model/Banana.java
|
||||
src/main/java/org/openapitools/model/Bar.java
|
||||
src/main/java/org/openapitools/model/BarCreate.java
|
||||
src/main/java/org/openapitools/model/BarRef.java
|
||||
src/main/java/org/openapitools/model/BarRefOrValue.java
|
||||
src/main/java/org/openapitools/model/Cat.java
|
||||
src/main/java/org/openapitools/model/Dog.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
|
||||
|
@ -0,0 +1,25 @@
|
||||
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.model.Cat;
|
||||
import org.openapitools.model.Dog;
|
||||
import org.springframework.lang.Nullable;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
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;
|
||||
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public sealed interface Animal permits Dog, Cat {
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Cat
|
||||
*/
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public final class Cat implements Animal {
|
||||
|
||||
private @Nullable Boolean declawed;
|
||||
|
||||
public Cat declawed(@Nullable Boolean declawed) {
|
||||
this.declawed = declawed;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get declawed
|
||||
* @return declawed
|
||||
*/
|
||||
|
||||
@Schema(name = "declawed", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("declawed")
|
||||
public @Nullable Boolean getDeclawed() {
|
||||
return declawed;
|
||||
}
|
||||
|
||||
public void setDeclawed(@Nullable Boolean declawed) {
|
||||
this.declawed = declawed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Cat cat = (Cat) o;
|
||||
return Objects.equals(this.declawed, cat.declawed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(declawed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Cat {\n");
|
||||
sb.append(" declawed: ").append(toIndentedString(declawed)).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 ");
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private Cat instance;
|
||||
|
||||
public Builder() {
|
||||
this(new Cat());
|
||||
}
|
||||
|
||||
protected Builder(Cat instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
protected Builder copyOf(Cat value) {
|
||||
this.instance.setDeclawed(value.declawed);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Cat.Builder declawed(Boolean declawed) {
|
||||
this.instance.declawed(declawed);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a built Cat instance.
|
||||
*
|
||||
* The builder is not reusable (NullPointerException)
|
||||
*/
|
||||
public Cat build() {
|
||||
try {
|
||||
return this.instance;
|
||||
} finally {
|
||||
// ensure that this.instance is not reused
|
||||
this.instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass() + "=(" + instance + ")";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a builder with no initialized field (except for the default values).
|
||||
*/
|
||||
public static Cat.Builder builder() {
|
||||
return new Cat.Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a builder with a shallow copy of this instance.
|
||||
*/
|
||||
public Cat.Builder toBuilder() {
|
||||
Cat.Builder builder = new Cat.Builder();
|
||||
return builder.copyOf(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,142 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Dog
|
||||
*/
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public final class Dog implements Animal {
|
||||
|
||||
private @Nullable Boolean bark;
|
||||
|
||||
public Dog bark(@Nullable Boolean bark) {
|
||||
this.bark = bark;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bark
|
||||
* @return bark
|
||||
*/
|
||||
|
||||
@Schema(name = "bark", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("bark")
|
||||
public @Nullable Boolean getBark() {
|
||||
return bark;
|
||||
}
|
||||
|
||||
public void setBark(@Nullable Boolean bark) {
|
||||
this.bark = bark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Dog dog = (Dog) o;
|
||||
return Objects.equals(this.bark, dog.bark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(bark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Dog {\n");
|
||||
sb.append(" bark: ").append(toIndentedString(bark)).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 ");
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private Dog instance;
|
||||
|
||||
public Builder() {
|
||||
this(new Dog());
|
||||
}
|
||||
|
||||
protected Builder(Dog instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
protected Builder copyOf(Dog value) {
|
||||
this.instance.setBark(value.bark);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Dog.Builder bark(Boolean bark) {
|
||||
this.instance.bark(bark);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a built Dog instance.
|
||||
*
|
||||
* The builder is not reusable (NullPointerException)
|
||||
*/
|
||||
public Dog build() {
|
||||
try {
|
||||
return this.instance;
|
||||
} finally {
|
||||
// ensure that this.instance is not reused
|
||||
this.instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass() + "=(" + instance + ")";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a builder with no initialized field (except for the default values).
|
||||
*/
|
||||
public static Dog.Builder builder() {
|
||||
return new Dog.Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a builder with a shallow copy of this instance.
|
||||
*/
|
||||
public Dog.Builder toBuilder() {
|
||||
Dog.Builder builder = new Dog.Builder();
|
||||
return builder.copyOf(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -272,3 +272,18 @@ components:
|
||||
required:
|
||||
- length
|
||||
type: object
|
||||
Animal:
|
||||
oneOf:
|
||||
- $ref: "#/components/schemas/Dog"
|
||||
- $ref: "#/components/schemas/Cat"
|
||||
x-one-of-name: Animal
|
||||
Cat:
|
||||
properties:
|
||||
declawed:
|
||||
type: boolean
|
||||
type: object
|
||||
Dog:
|
||||
properties:
|
||||
bark:
|
||||
type: boolean
|
||||
type: object
|
||||
|
@ -9,12 +9,15 @@ src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java
|
||||
src/main/java/org/openapitools/configuration/HomeController.java
|
||||
src/main/java/org/openapitools/configuration/SpringDocConfiguration.java
|
||||
src/main/java/org/openapitools/model/Addressable.java
|
||||
src/main/java/org/openapitools/model/Animal.java
|
||||
src/main/java/org/openapitools/model/Apple.java
|
||||
src/main/java/org/openapitools/model/Banana.java
|
||||
src/main/java/org/openapitools/model/Bar.java
|
||||
src/main/java/org/openapitools/model/BarCreate.java
|
||||
src/main/java/org/openapitools/model/BarRef.java
|
||||
src/main/java/org/openapitools/model/BarRefOrValue.java
|
||||
src/main/java/org/openapitools/model/Cat.java
|
||||
src/main/java/org/openapitools/model/Dog.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
|
||||
|
@ -0,0 +1,25 @@
|
||||
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.model.Cat;
|
||||
import org.openapitools.model.Dog;
|
||||
import org.springframework.lang.Nullable;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
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;
|
||||
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public interface Animal {
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Cat
|
||||
*/
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Cat implements Animal {
|
||||
|
||||
private @Nullable Boolean declawed;
|
||||
|
||||
public Cat declawed(@Nullable Boolean declawed) {
|
||||
this.declawed = declawed;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get declawed
|
||||
* @return declawed
|
||||
*/
|
||||
|
||||
@Schema(name = "declawed", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("declawed")
|
||||
public @Nullable Boolean getDeclawed() {
|
||||
return declawed;
|
||||
}
|
||||
|
||||
public void setDeclawed(@Nullable Boolean declawed) {
|
||||
this.declawed = declawed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Cat cat = (Cat) o;
|
||||
return Objects.equals(this.declawed, cat.declawed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(declawed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Cat {\n");
|
||||
sb.append(" declawed: ").append(toIndentedString(declawed)).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 ");
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private Cat instance;
|
||||
|
||||
public Builder() {
|
||||
this(new Cat());
|
||||
}
|
||||
|
||||
protected Builder(Cat instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
protected Builder copyOf(Cat value) {
|
||||
this.instance.setDeclawed(value.declawed);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Cat.Builder declawed(Boolean declawed) {
|
||||
this.instance.declawed(declawed);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a built Cat instance.
|
||||
*
|
||||
* The builder is not reusable (NullPointerException)
|
||||
*/
|
||||
public Cat build() {
|
||||
try {
|
||||
return this.instance;
|
||||
} finally {
|
||||
// ensure that this.instance is not reused
|
||||
this.instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass() + "=(" + instance + ")";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a builder with no initialized field (except for the default values).
|
||||
*/
|
||||
public static Cat.Builder builder() {
|
||||
return new Cat.Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a builder with a shallow copy of this instance.
|
||||
*/
|
||||
public Cat.Builder toBuilder() {
|
||||
Cat.Builder builder = new Cat.Builder();
|
||||
return builder.copyOf(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,142 @@
|
||||
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.springframework.lang.Nullable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Dog
|
||||
*/
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Dog implements Animal {
|
||||
|
||||
private @Nullable Boolean bark;
|
||||
|
||||
public Dog bark(@Nullable Boolean bark) {
|
||||
this.bark = bark;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bark
|
||||
* @return bark
|
||||
*/
|
||||
|
||||
@Schema(name = "bark", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonProperty("bark")
|
||||
public @Nullable Boolean getBark() {
|
||||
return bark;
|
||||
}
|
||||
|
||||
public void setBark(@Nullable Boolean bark) {
|
||||
this.bark = bark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Dog dog = (Dog) o;
|
||||
return Objects.equals(this.bark, dog.bark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(bark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Dog {\n");
|
||||
sb.append(" bark: ").append(toIndentedString(bark)).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 ");
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private Dog instance;
|
||||
|
||||
public Builder() {
|
||||
this(new Dog());
|
||||
}
|
||||
|
||||
protected Builder(Dog instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
protected Builder copyOf(Dog value) {
|
||||
this.instance.setBark(value.bark);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Dog.Builder bark(Boolean bark) {
|
||||
this.instance.bark(bark);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a built Dog instance.
|
||||
*
|
||||
* The builder is not reusable (NullPointerException)
|
||||
*/
|
||||
public Dog build() {
|
||||
try {
|
||||
return this.instance;
|
||||
} finally {
|
||||
// ensure that this.instance is not reused
|
||||
this.instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass() + "=(" + instance + ")";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a builder with no initialized field (except for the default values).
|
||||
*/
|
||||
public static Dog.Builder builder() {
|
||||
return new Dog.Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a builder with a shallow copy of this instance.
|
||||
*/
|
||||
public Dog.Builder toBuilder() {
|
||||
Dog.Builder builder = new Dog.Builder();
|
||||
return builder.copyOf(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -272,3 +272,18 @@ components:
|
||||
required:
|
||||
- length
|
||||
type: object
|
||||
Animal:
|
||||
oneOf:
|
||||
- $ref: "#/components/schemas/Dog"
|
||||
- $ref: "#/components/schemas/Cat"
|
||||
x-one-of-name: Animal
|
||||
Cat:
|
||||
properties:
|
||||
declawed:
|
||||
type: boolean
|
||||
type: object
|
||||
Dog:
|
||||
properties:
|
||||
bark:
|
||||
type: boolean
|
||||
type: object
|
||||
|
Loading…
x
Reference in New Issue
Block a user