forked from loafle/openapi-generator-original
add test case for nullable parent property (#16552)
* add nullable case to spring test spec * generate samples for changed spring input * add nullable case to general test spec * generate samples for changed general input * generate samples again * generates samples again * re-build from new sources, generates samples again
This commit is contained in:
@@ -15,6 +15,7 @@ docs/ArrayTest.md
|
||||
docs/Capitalization.md
|
||||
docs/Cat.md
|
||||
docs/Category.md
|
||||
docs/ChildWithNullable.md
|
||||
docs/ClassModel.md
|
||||
docs/Client.md
|
||||
docs/DefaultApi.md
|
||||
@@ -50,6 +51,7 @@ docs/OuterEnumDefaultValue.md
|
||||
docs/OuterEnumInteger.md
|
||||
docs/OuterEnumIntegerDefaultValue.md
|
||||
docs/OuterObjectWithEnumProperty.md
|
||||
docs/ParentWithNullable.md
|
||||
docs/Pet.md
|
||||
docs/PetApi.md
|
||||
docs/ReadOnlyFirst.md
|
||||
@@ -96,6 +98,7 @@ src/main/java/org/openapitools/client/model/ArrayTest.java
|
||||
src/main/java/org/openapitools/client/model/Capitalization.java
|
||||
src/main/java/org/openapitools/client/model/Cat.java
|
||||
src/main/java/org/openapitools/client/model/Category.java
|
||||
src/main/java/org/openapitools/client/model/ChildWithNullable.java
|
||||
src/main/java/org/openapitools/client/model/ClassModel.java
|
||||
src/main/java/org/openapitools/client/model/Client.java
|
||||
src/main/java/org/openapitools/client/model/DeprecatedObject.java
|
||||
@@ -128,6 +131,7 @@ src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java
|
||||
src/main/java/org/openapitools/client/model/OuterEnumInteger.java
|
||||
src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java
|
||||
src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java
|
||||
src/main/java/org/openapitools/client/model/ParentWithNullable.java
|
||||
src/main/java/org/openapitools/client/model/Pet.java
|
||||
src/main/java/org/openapitools/client/model/ReadOnlyFirst.java
|
||||
src/main/java/org/openapitools/client/model/SingleRefType.java
|
||||
|
||||
@@ -132,6 +132,7 @@ Class | Method | HTTP request | Description
|
||||
*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
|
||||
*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
|
||||
*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
|
||||
*FakeApi* | [**testNullable**](docs/FakeApi.md#testNullable) | **POST** /fake/nullable | test nullable parent property
|
||||
*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters |
|
||||
*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case
|
||||
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
@@ -168,6 +169,7 @@ Class | Method | HTTP request | Description
|
||||
- [Capitalization](docs/Capitalization.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [ChildWithNullable](docs/ChildWithNullable.md)
|
||||
- [ClassModel](docs/ClassModel.md)
|
||||
- [Client](docs/Client.md)
|
||||
- [DeprecatedObject](docs/DeprecatedObject.md)
|
||||
@@ -200,6 +202,7 @@ Class | Method | HTTP request | Description
|
||||
- [OuterEnumInteger](docs/OuterEnumInteger.md)
|
||||
- [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
|
||||
- [OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
|
||||
- [ParentWithNullable](docs/ParentWithNullable.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||
- [SingleRefType](docs/SingleRefType.md)
|
||||
|
||||
@@ -1031,6 +1031,25 @@ paths:
|
||||
- fake
|
||||
x-content-type: application/json
|
||||
x-accepts: application/json
|
||||
/fake/nullable:
|
||||
post:
|
||||
description: ""
|
||||
operationId: testNullable
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ChildWithNullable'
|
||||
description: request body
|
||||
required: true
|
||||
responses:
|
||||
"200":
|
||||
description: successful operation
|
||||
summary: test nullable parent property
|
||||
tags:
|
||||
- fake
|
||||
x-content-type: application/json
|
||||
x-accepts: application/json
|
||||
/fake/body-with-query-params:
|
||||
put:
|
||||
operationId: testBodyWithQueryParams
|
||||
@@ -1862,6 +1881,25 @@ components:
|
||||
OuterBoolean:
|
||||
type: boolean
|
||||
x-codegen-body-parameter-name: boolean_post_body
|
||||
ParentWithNullable:
|
||||
discriminator:
|
||||
propertyName: type
|
||||
properties:
|
||||
type:
|
||||
enum:
|
||||
- ChildWithNullable
|
||||
type: string
|
||||
nullableProperty:
|
||||
nullable: true
|
||||
type: string
|
||||
type: object
|
||||
ChildWithNullable:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ParentWithNullable'
|
||||
- properties:
|
||||
otherProperty:
|
||||
type: string
|
||||
type: object
|
||||
StringBooleanMap:
|
||||
additionalProperties:
|
||||
type: boolean
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# ChildWithNullable
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**otherProperty** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
| [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) |
|
||||
| [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties |
|
||||
| [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data |
|
||||
| [**testNullable**](FakeApi.md#testNullable) | **POST** /fake/nullable | test nullable parent property |
|
||||
| [**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | |
|
||||
|
||||
|
||||
@@ -1199,6 +1200,71 @@ No authorization required
|
||||
| **200** | successful operation | - |
|
||||
|
||||
|
||||
## testNullable
|
||||
|
||||
> testNullable(childWithNullable)
|
||||
|
||||
test nullable parent property
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```java
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.Configuration;
|
||||
import org.openapitools.client.models.*;
|
||||
import org.openapitools.client.api.FakeApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
ChildWithNullable childWithNullable = new ChildWithNullable(); // ChildWithNullable | request body
|
||||
try {
|
||||
apiInstance.testNullable(childWithNullable);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#testNullable");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **childWithNullable** | [**ChildWithNullable**](ChildWithNullable.md)| request body | |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | successful operation | - |
|
||||
|
||||
|
||||
## testQueryParameterCollectionFormat
|
||||
|
||||
> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language)
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
# ParentWithNullable
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|
||||
|**nullableProperty** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
## Enum: TypeEnum
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| CHILDWITHNULLABLE | "ChildWithNullable" |
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.openapitools.client.api;
|
||||
import org.openapitools.client.ApiClient;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.client.model.ChildWithNullable;
|
||||
import org.openapitools.client.model.Client;
|
||||
import org.openapitools.client.model.EnumClass;
|
||||
import org.openapitools.client.model.FakeBigDecimalMap200Response;
|
||||
@@ -1449,6 +1450,75 @@ public class FakeApi {
|
||||
public ResponseSpec testJsonFormDataWithResponseSpec(String param, String param2) throws WebClientResponseException {
|
||||
return testJsonFormDataRequestCreation(param, param2);
|
||||
}
|
||||
/**
|
||||
* test nullable parent property
|
||||
*
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param childWithNullable request body
|
||||
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testNullableRequestCreation(ChildWithNullable childWithNullable) throws WebClientResponseException {
|
||||
Object postBody = childWithNullable;
|
||||
// verify the required parameter 'childWithNullable' is set
|
||||
if (childWithNullable == null) {
|
||||
throw new WebClientResponseException("Missing the required parameter 'childWithNullable' when calling testNullable", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
|
||||
}
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<String, Object>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] localVarAccepts = { };
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"application/json"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> localVarReturnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI("/fake/nullable", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* test nullable parent property
|
||||
*
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param childWithNullable request body
|
||||
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Mono<Void> testNullable(ChildWithNullable childWithNullable) throws WebClientResponseException {
|
||||
ParameterizedTypeReference<Void> localVarReturnType = new ParameterizedTypeReference<Void>() {};
|
||||
return testNullableRequestCreation(childWithNullable).bodyToMono(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* test nullable parent property
|
||||
*
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param childWithNullable request body
|
||||
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Mono<ResponseEntity<Void>> testNullableWithHttpInfo(ChildWithNullable childWithNullable) throws WebClientResponseException {
|
||||
ParameterizedTypeReference<Void> localVarReturnType = new ParameterizedTypeReference<Void>() {};
|
||||
return testNullableRequestCreation(childWithNullable).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* test nullable parent property
|
||||
*
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param childWithNullable request body
|
||||
* @return ResponseSpec
|
||||
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testNullableWithResponseSpec(ChildWithNullable childWithNullable) throws WebClientResponseException {
|
||||
return testNullableRequestCreation(childWithNullable);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* To test the collection format in query parameters
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.openapitools.client.model.ParentWithNullable;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* ChildWithNullable
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
ChildWithNullable.JSON_PROPERTY_OTHER_PROPERTY
|
||||
})
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
@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)
|
||||
|
||||
public class ChildWithNullable extends ParentWithNullable {
|
||||
public static final String JSON_PROPERTY_OTHER_PROPERTY = "otherProperty";
|
||||
private String otherProperty;
|
||||
|
||||
public ChildWithNullable() {
|
||||
|
||||
}
|
||||
|
||||
public ChildWithNullable otherProperty(String otherProperty) {
|
||||
|
||||
this.otherProperty = otherProperty;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get otherProperty
|
||||
* @return otherProperty
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "")
|
||||
@JsonProperty(JSON_PROPERTY_OTHER_PROPERTY)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public String getOtherProperty() {
|
||||
return otherProperty;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_OTHER_PROPERTY)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setOtherProperty(String otherProperty) {
|
||||
this.otherProperty = otherProperty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChildWithNullable type(TypeEnum type) {
|
||||
this.setType(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChildWithNullable nullableProperty(String nullableProperty) {
|
||||
this.setNullableProperty(nullableProperty);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ChildWithNullable childWithNullable = (ChildWithNullable) o;
|
||||
return Objects.equals(this.otherProperty, childWithNullable.otherProperty) &&
|
||||
super.equals(o);
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(otherProperty, super.hashCode());
|
||||
}
|
||||
|
||||
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ChildWithNullable {\n");
|
||||
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
||||
sb.append(" otherProperty: ").append(toIndentedString(otherProperty)).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,206 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import java.util.NoSuchElementException;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* ParentWithNullable
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
ParentWithNullable.JSON_PROPERTY_TYPE,
|
||||
ParentWithNullable.JSON_PROPERTY_NULLABLE_PROPERTY
|
||||
})
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
@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 = ChildWithNullable.class, name = "ChildWithNullable"),
|
||||
})
|
||||
|
||||
public class ParentWithNullable {
|
||||
/**
|
||||
* Gets or Sets type
|
||||
*/
|
||||
public enum TypeEnum {
|
||||
CHILDWITHNULLABLE("ChildWithNullable");
|
||||
|
||||
private String value;
|
||||
|
||||
TypeEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static TypeEnum fromValue(String value) {
|
||||
for (TypeEnum b : TypeEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
public static final String JSON_PROPERTY_TYPE = "type";
|
||||
protected TypeEnum type;
|
||||
|
||||
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";
|
||||
private JsonNullable<String> nullableProperty = JsonNullable.<String>undefined();
|
||||
|
||||
public ParentWithNullable() {
|
||||
}
|
||||
|
||||
public ParentWithNullable type(TypeEnum type) {
|
||||
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type
|
||||
* @return type
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "")
|
||||
@JsonProperty(JSON_PROPERTY_TYPE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public TypeEnum getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_TYPE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setType(TypeEnum type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
public ParentWithNullable nullableProperty(String nullableProperty) {
|
||||
this.nullableProperty = JsonNullable.<String>of(nullableProperty);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nullableProperty
|
||||
* @return nullableProperty
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "")
|
||||
@JsonIgnore
|
||||
|
||||
public String getNullableProperty() {
|
||||
return nullableProperty.orElse(null);
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_NULLABLE_PROPERTY)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public JsonNullable<String> getNullableProperty_JsonNullable() {
|
||||
return nullableProperty;
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_NULLABLE_PROPERTY)
|
||||
public void setNullableProperty_JsonNullable(JsonNullable<String> nullableProperty) {
|
||||
this.nullableProperty = nullableProperty;
|
||||
}
|
||||
|
||||
public void setNullableProperty(String nullableProperty) {
|
||||
this.nullableProperty = JsonNullable.<String>of(nullableProperty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ParentWithNullable parentWithNullable = (ParentWithNullable) o;
|
||||
return Objects.equals(this.type, parentWithNullable.type) &&
|
||||
equalsNullable(this.nullableProperty, parentWithNullable.nullableProperty);
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(type, hashCodeNullable(nullableProperty));
|
||||
}
|
||||
|
||||
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ParentWithNullable {\n");
|
||||
sb.append(" type: ").append(toIndentedString(type)).append("\n");
|
||||
sb.append(" nullableProperty: ").append(toIndentedString(nullableProperty)).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,69 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.openapitools.client.model.ParentWithNullable;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Model tests for ChildWithNullable
|
||||
*/
|
||||
public class ChildWithNullableTest {
|
||||
private final ChildWithNullable model = new ChildWithNullable();
|
||||
|
||||
/**
|
||||
* Model tests for ChildWithNullable
|
||||
*/
|
||||
@Test
|
||||
public void testChildWithNullable() {
|
||||
// TODO: test ChildWithNullable
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'type'
|
||||
*/
|
||||
@Test
|
||||
public void typeTest() {
|
||||
// TODO: test type
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'nullableProperty'
|
||||
*/
|
||||
@Test
|
||||
public void nullablePropertyTest() {
|
||||
// TODO: test nullableProperty
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'otherProperty'
|
||||
*/
|
||||
@Test
|
||||
public void otherPropertyTest() {
|
||||
// TODO: test otherProperty
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import java.util.NoSuchElementException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Model tests for ParentWithNullable
|
||||
*/
|
||||
public class ParentWithNullableTest {
|
||||
private final ParentWithNullable model = new ParentWithNullable();
|
||||
|
||||
/**
|
||||
* Model tests for ParentWithNullable
|
||||
*/
|
||||
@Test
|
||||
public void testParentWithNullable() {
|
||||
// TODO: test ParentWithNullable
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'type'
|
||||
*/
|
||||
@Test
|
||||
public void typeTest() {
|
||||
// TODO: test type
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'nullableProperty'
|
||||
*/
|
||||
@Test
|
||||
public void nullablePropertyTest() {
|
||||
// TODO: test nullableProperty
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user