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:
martin-mfg 2023-09-12 09:59:58 +02:00 committed by GitHub
parent 196c2b1642
commit d6695056fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
346 changed files with 20471 additions and 0 deletions

View File

@ -1014,6 +1014,23 @@ paths:
type: string
description: request body
required: true
/fake/nullable:
post:
tags:
- fake
summary: test nullable parent property
description: ""
operationId: testNullable
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ChildWithNullable'
description: request body
required: true
responses:
"200":
description: successful operation
/fake/body-with-query-params:
put:
tags:
@ -1826,6 +1843,25 @@ components:
OuterBoolean:
type: boolean
x-codegen-body-parameter-name: boolean_post_body
ParentWithNullable:
type: object
discriminator:
propertyName: type
properties:
type:
type: string
enum:
- ChildWithNullable
nullableProperty:
type: string
nullable: true
ChildWithNullable:
allOf:
- $ref: '#/components/schemas/ParentWithNullable'
- type: object
properties:
otherProperty:
type: string
StringBooleanMap:
additionalProperties:
type: boolean

View File

@ -924,6 +924,23 @@ paths:
responses:
"200":
description: successful operation
/fake/nullable:
post:
tags:
- fake
summary: test nullable parent property
description: ""
operationId: testNullable
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ChildWithNullable'
description: request body
required: true
responses:
"200":
description: successful operation
/fake/body-with-query-params:
put:
tags:
@ -1743,6 +1760,25 @@ components:
OuterBoolean:
type: boolean
x-codegen-body-parameter-name: boolean_post_body
ParentWithNullable:
type: object
discriminator:
propertyName: type
properties:
type:
type: string
enum:
- ChildWithNullable
nullableProperty:
type: string
nullable: true
ChildWithNullable:
allOf:
- $ref: '#/components/schemas/ParentWithNullable'
- type: object
properties:
otherProperty:
type: string
StringBooleanMap:
additionalProperties:
type: boolean

View File

@ -24,6 +24,7 @@ lib/openapi_petstore/model/array_test.ex
lib/openapi_petstore/model/capitalization.ex
lib/openapi_petstore/model/cat.ex
lib/openapi_petstore/model/category.ex
lib/openapi_petstore/model/child_with_nullable.ex
lib/openapi_petstore/model/class_model.ex
lib/openapi_petstore/model/client.ex
lib/openapi_petstore/model/deprecated_model.ex
@ -53,6 +54,7 @@ lib/openapi_petstore/model/outer_enum_default_value.ex
lib/openapi_petstore/model/outer_enum_integer.ex
lib/openapi_petstore/model/outer_enum_integer_default_value.ex
lib/openapi_petstore/model/outer_object_with_enum_property.ex
lib/openapi_petstore/model/parent_with_nullable.ex
lib/openapi_petstore/model/pet.ex
lib/openapi_petstore/model/read_only_first.ex
lib/openapi_petstore/model/return.ex

View File

@ -618,6 +618,37 @@ defmodule OpenapiPetstore.Api.Fake do
])
end
@doc """
test nullable parent property
### Parameters
- `connection` (OpenapiPetstore.Connection): Connection to server
- `child_with_nullable` (ChildWithNullable): request body
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec test_nullable(Tesla.Env.client, OpenapiPetstore.Model.ChildWithNullable.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def test_nullable(connection, child_with_nullable, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/fake/nullable")
|> add_param(:body, :body, child_with_nullable)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false}
])
end
@doc """
To test the collection format in query parameters

View File

@ -0,0 +1,26 @@
# NOTE: This file is auto generated by OpenAPI Generator 7.0.1-SNAPSHOT (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule OpenapiPetstore.Model.ChildWithNullable do
@moduledoc """
"""
@derive Jason.Encoder
defstruct [
:type,
:nullableProperty,
:otherProperty
]
@type t :: %__MODULE__{
:type => String.t | nil,
:nullableProperty => String.t | nil,
:otherProperty => String.t | nil
}
def decode(value) do
value
end
end

View File

@ -0,0 +1,24 @@
# NOTE: This file is auto generated by OpenAPI Generator 7.0.1-SNAPSHOT (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule OpenapiPetstore.Model.ParentWithNullable do
@moduledoc """
"""
@derive Jason.Encoder
defstruct [
:type,
:nullableProperty
]
@type t :: %__MODULE__{
:type => String.t | nil,
:nullableProperty => String.t | nil
}
def decode(value) do
value
end
end

View File

@ -9,6 +9,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
@ -44,6 +45,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
@ -74,6 +76,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
@ -106,6 +109,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

View File

@ -0,0 +1,13 @@
# ChildWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**otherProperty** | **String** | | [optional] |

View File

@ -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 | |
@ -640,6 +641,41 @@ No authorization required
| **200** | successful operation | - |
## testNullable
> void testNullable(childWithNullable)
test nullable parent property
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **childWithNullable** | [**ChildWithNullable**](ChildWithNullable.md)| request body | |
### Return type
[**void**](Void.md)
### 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
> void testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language)

View File

@ -0,0 +1,22 @@
# ParentWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|**nullableProperty** | **String** | | [optional] |
## Enum: TypeEnum
| Name | Value |
|---- | -----|
| CHILDWITHNULLABLE | "ChildWithNullable" |

View File

@ -26,6 +26,7 @@ import org.eclipse.microprofile.rest.client.annotation.RegisterProvider;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
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;
@ -169,6 +170,15 @@ public interface FakeApi {
@Consumes({ "application/x-www-form-urlencoded" })
void testJsonFormData(@FormParam("param") String param, @FormParam("param2") String param2) throws ApiException, ProcessingException;
/**
* test nullable parent property
*
*/
@POST
@Path("/nullable")
@Consumes({ "application/json" })
void testNullable(ChildWithNullable childWithNullable) throws ApiException, ProcessingException;
@PUT
@Path("/test-query-parameters")
void testQueryParameterCollectionFormat(@QueryParam("pipe") List<String> pipe, @QueryParam("ioutil") List<String> ioutil, @QueryParam("http") List<String> http, @QueryParam("url") List<String> url, @QueryParam("context") List<String> context, @QueryParam("allowEmpty") String allowEmpty, @QueryParam("language") Map<String, String> language) throws ApiException, ProcessingException;

View File

@ -0,0 +1,78 @@
/**
* 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 org.openapitools.client.model.ParentWithNullable;
import org.openapitools.jackson.nullable.JsonNullable;
public class ChildWithNullable extends ParentWithNullable {
private String otherProperty;
/**
* Get otherProperty
* @return otherProperty
**/
public String getOtherProperty() {
return otherProperty;
}
/**
* Set otherProperty
**/
public void setOtherProperty(String otherProperty) {
this.otherProperty = otherProperty;
}
public ChildWithNullable otherProperty(String otherProperty) {
this.otherProperty = otherProperty;
return this;
}
/**
* Create a string representation of this pojo.
**/
@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 static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,123 @@
/**
* 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 org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.NoSuchElementException;
public class ParentWithNullable {
public enum TypeEnum {
CHILDWITHNULLABLE(String.valueOf("ChildWithNullable"));
String value;
TypeEnum (String v) {
value = v;
}
public String value() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
private TypeEnum type;
private String nullableProperty;
/**
* Get type
* @return type
**/
public TypeEnum getType() {
return type;
}
/**
* Set type
**/
public void setType(TypeEnum type) {
this.type = type;
}
public ParentWithNullable type(TypeEnum type) {
this.type = type;
return this;
}
/**
* Get nullableProperty
* @return nullableProperty
**/
public String getNullableProperty() {
return nullableProperty;
}
/**
* Set nullableProperty
**/
public void setNullableProperty(String nullableProperty) {
this.nullableProperty = nullableProperty;
}
public ParentWithNullable nullableProperty(String nullableProperty) {
this.nullableProperty = nullableProperty;
return this;
}
/**
* Create a string representation of this pojo.
**/
@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 static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,67 @@
/**
* 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 org.openapitools.client.model.ParentWithNullable;
import org.openapitools.jackson.nullable.JsonNullable;
import org.junit.jupiter.api.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
}
}

View File

@ -0,0 +1,60 @@
/**
* 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 org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.NoSuchElementException;
import org.junit.jupiter.api.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
}
}

View File

@ -9,6 +9,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
@ -44,6 +45,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
@ -83,6 +85,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
@ -115,6 +118,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

View File

@ -0,0 +1,13 @@
# ChildWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**otherProperty** | **String** | | [optional] |

View File

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

View File

@ -0,0 +1,22 @@
# ParentWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|**nullableProperty** | **String** | | [optional] |
## Enum: TypeEnum
| Name | Value |
|---- | -----|
| CHILDWITHNULLABLE | &quot;ChildWithNullable&quot; |

View File

@ -14,6 +14,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiResponse;
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;
@ -144,6 +145,14 @@ public interface FakeApi {
*/
ApiResponse<Void> testJsonFormData(String param, String param2);
/**
* test nullable parent property
*
* @param childWithNullable request body (required)
* @return {@code ApiResponse<Void>}
*/
ApiResponse<Void> testNullable(ChildWithNullable childWithNullable);
ApiResponse<Void> testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, Map<String, String> language);
}

View File

@ -30,6 +30,7 @@ import io.helidon.webclient.WebClientResponse;
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;
@ -75,6 +76,7 @@ public class FakeApiImpl implements FakeApi {
protected static final GenericType<Void> RESPONSE_TYPE_testGroupParameters = ResponseType.create(Void.class);
protected static final GenericType<Void> RESPONSE_TYPE_testInlineAdditionalProperties = ResponseType.create(Void.class);
protected static final GenericType<Void> RESPONSE_TYPE_testJsonFormData = ResponseType.create(Void.class);
protected static final GenericType<Void> RESPONSE_TYPE_testNullable = ResponseType.create(Void.class);
protected static final GenericType<Void> RESPONSE_TYPE_testQueryParameterCollectionFormat = ResponseType.create(Void.class);
/**
@ -856,6 +858,44 @@ public class FakeApiImpl implements FakeApi {
return ApiResponse.create(RESPONSE_TYPE_testJsonFormData, webClientResponse);
}
@Override
public ApiResponse<Void> testNullable(ChildWithNullable childWithNullable) {
Objects.requireNonNull(childWithNullable, "Required parameter 'childWithNullable' not specified");
WebClientRequestBuilder webClientRequestBuilder = testNullableRequestBuilder(childWithNullable);
return testNullableSubmit(webClientRequestBuilder, childWithNullable);
}
/**
* Creates a {@code WebClientRequestBuilder} for the testNullable operation.
* Optional customization point for subclasses.
*
* @param childWithNullable request body (required)
* @return WebClientRequestBuilder for testNullable
*/
protected WebClientRequestBuilder testNullableRequestBuilder(ChildWithNullable childWithNullable) {
WebClientRequestBuilder webClientRequestBuilder = apiClient.webClient()
.method("POST");
webClientRequestBuilder.path("/fake/nullable");
webClientRequestBuilder.contentType(MediaType.APPLICATION_JSON);
webClientRequestBuilder.accept(MediaType.APPLICATION_JSON);
return webClientRequestBuilder;
}
/**
* Initiates the request for the testNullable operation.
* Optional customization point for subclasses.
*
* @param webClientRequestBuilder the request builder to use for submitting the request
* @param childWithNullable request body (required)
* @return {@code ApiResponse<Void>} for the submitted request
*/
protected ApiResponse<Void> testNullableSubmit(WebClientRequestBuilder webClientRequestBuilder, ChildWithNullable childWithNullable) {
Single<WebClientResponse> webClientResponse = webClientRequestBuilder.submit(childWithNullable);
return ApiResponse.create(RESPONSE_TYPE_testNullable, webClientResponse);
}
@Override
public ApiResponse<Void> testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, Map<String, String> language) {
Objects.requireNonNull(pipe, "Required parameter 'pipe' not specified");

View File

@ -0,0 +1,78 @@
/**
* 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 org.openapitools.client.model.ParentWithNullable;
import org.openapitools.jackson.nullable.JsonNullable;
public class ChildWithNullable extends ParentWithNullable {
private String otherProperty;
/**
* Get otherProperty
* @return otherProperty
**/
public String getOtherProperty() {
return otherProperty;
}
/**
* Set otherProperty
**/
public void setOtherProperty(String otherProperty) {
this.otherProperty = otherProperty;
}
public ChildWithNullable otherProperty(String otherProperty) {
this.otherProperty = otherProperty;
return this;
}
/**
* Create a string representation of this pojo.
**/
@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 static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,123 @@
/**
* 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 org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.NoSuchElementException;
public class ParentWithNullable {
public enum TypeEnum {
CHILDWITHNULLABLE(String.valueOf("ChildWithNullable"));
String value;
TypeEnum (String v) {
value = v;
}
public String value() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
private TypeEnum type;
private String nullableProperty;
/**
* Get type
* @return type
**/
public TypeEnum getType() {
return type;
}
/**
* Set type
**/
public void setType(TypeEnum type) {
this.type = type;
}
public ParentWithNullable type(TypeEnum type) {
this.type = type;
return this;
}
/**
* Get nullableProperty
* @return nullableProperty
**/
public String getNullableProperty() {
return nullableProperty;
}
/**
* Set nullableProperty
**/
public void setNullableProperty(String nullableProperty) {
this.nullableProperty = nullableProperty;
}
public ParentWithNullable nullableProperty(String nullableProperty) {
this.nullableProperty = nullableProperty;
return this;
}
/**
* Create a string representation of this pojo.
**/
@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 static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,67 @@
/**
* 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 org.openapitools.client.model.ParentWithNullable;
import org.openapitools.jackson.nullable.JsonNullable;
import org.junit.jupiter.api.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
}
}

View File

@ -0,0 +1,60 @@
/**
* 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 org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.NoSuchElementException;
import org.junit.jupiter.api.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
}
}

View File

@ -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
@ -99,6 +101,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
@ -131,6 +134,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

View File

@ -125,6 +125,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
@ -161,6 +162,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)
@ -193,6 +195,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)

View File

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

View File

@ -0,0 +1,13 @@
# ChildWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**otherProperty** | **String** | | [optional] |

View File

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

View File

@ -0,0 +1,22 @@
# ParentWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|**nullableProperty** | **String** | | [optional] |
## Enum: TypeEnum
| Name | Value |
|---- | -----|
| CHILDWITHNULLABLE | &quot;ChildWithNullable&quot; |

View File

@ -20,6 +20,7 @@ import org.openapitools.client.Configuration;
import org.openapitools.client.Pair;
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;
@ -1407,6 +1408,77 @@ if (param2 != null)
);
}
/**
* test nullable parent property
*
* @param childWithNullable request body (required)
* @throws ApiException if fails to make API call
*/
public void testNullable(ChildWithNullable childWithNullable) throws ApiException {
this.testNullable(childWithNullable, Collections.emptyMap());
}
/**
* test nullable parent property
*
* @param childWithNullable request body (required)
* @param additionalHeaders additionalHeaders for this call
* @throws ApiException if fails to make API call
*/
public void testNullable(ChildWithNullable childWithNullable, Map<String, String> additionalHeaders) throws ApiException {
Object localVarPostBody = childWithNullable;
// verify the required parameter 'childWithNullable' is set
if (childWithNullable == null) {
throw new ApiException(400, "Missing the required parameter 'childWithNullable' when calling testNullable");
}
// create path and map variables
String localVarPath = "/fake/nullable";
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.putAll(additionalHeaders);
final String[] localVarAccepts = {
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarQueryStringJoiner.toString(),
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
*
* To test the collection format in query parameters

View File

@ -0,0 +1,208 @@
/*
* 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 org.openapitools.client.model.ParentWithNullable;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.StringJoiner;
/**
* 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
@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 ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `type` to the URL query string
if (getType() != null) {
try {
joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
// add `nullableProperty` to the URL query string
if (getNullableProperty() != null) {
try {
joiner.add(String.format("%snullableProperty%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getNullableProperty()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
// add `otherProperty` to the URL query string
if (getOtherProperty() != null) {
try {
joiner.add(String.format("%sotherProperty%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getOtherProperty()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
return joiner.toString();
}
}

View File

@ -0,0 +1,261 @@
/*
* 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 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;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.StringJoiner;
/**
* 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
@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
@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 ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `type` to the URL query string
if (getType() != null) {
try {
joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
// add `nullableProperty` to the URL query string
if (getNullableProperty() != null) {
try {
joiner.add(String.format("%snullableProperty%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getNullableProperty()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
return joiner.toString();
}
}

View File

@ -0,0 +1,68 @@
/*
* 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 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
}
}

View File

@ -0,0 +1,62 @@
/*
* 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 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
}
}

View File

@ -48,6 +48,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
@ -80,6 +81,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

View File

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

View File

@ -5,6 +5,7 @@ import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.ApiResponse;
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;
@ -839,6 +840,33 @@ public interface FakeApi extends ApiClient.Api {
/**
* test nullable parent property
*
* @param childWithNullable request body (required)
*/
@RequestLine("POST /fake/nullable")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
void testNullable(ChildWithNullable childWithNullable);
/**
* test nullable parent property
* Similar to <code>testNullable</code> but it also returns the http response headers .
*
* @param childWithNullable request body (required)
*/
@RequestLine("POST /fake/nullable")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
ApiResponse<Void> testNullableWithHttpInfo(ChildWithNullable childWithNullable);
/**
*
* To test the collection format in query parameters

View File

@ -0,0 +1,129 @@
/*
* 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 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
@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 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 ");
}
}

View File

@ -0,0 +1,204 @@
/*
* 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 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
@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
@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 ");
}
}

View File

@ -0,0 +1,66 @@
/*
* 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 org.openapitools.client.model.ParentWithNullable;
import org.openapitools.jackson.nullable.JsonNullable;
import org.junit.jupiter.api.Test;
/**
* Model tests for ChildWithNullable
*/
class ChildWithNullableTest {
private final ChildWithNullable model = new ChildWithNullable();
/**
* Model tests for ChildWithNullable
*/
@Test
void testChildWithNullable() {
// TODO: test ChildWithNullable
}
/**
* Test the property 'type'
*/
@Test
void typeTest() {
// TODO: test type
}
/**
* Test the property 'nullableProperty'
*/
@Test
void nullablePropertyTest() {
// TODO: test nullableProperty
}
/**
* Test the property 'otherProperty'
*/
@Test
void otherPropertyTest() {
// TODO: test otherProperty
}
}

View File

@ -0,0 +1,60 @@
/*
* 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 org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import org.junit.jupiter.api.Test;
/**
* Model tests for ParentWithNullable
*/
class ParentWithNullableTest {
private final ParentWithNullable model = new ParentWithNullable();
/**
* Model tests for ParentWithNullable
*/
@Test
void testParentWithNullable() {
// TODO: test ParentWithNullable
}
/**
* Test the property 'type'
*/
@Test
void typeTest() {
// TODO: test type
}
/**
* Test the property 'nullableProperty'
*/
@Test
void nullablePropertyTest() {
// TODO: test nullableProperty
}
}

View File

@ -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
@ -100,6 +102,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
@ -132,6 +135,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

View File

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

View File

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

View File

@ -0,0 +1,13 @@
# ChildWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**otherProperty** | **String** | | [optional] |

View File

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

View File

@ -0,0 +1,22 @@
# ParentWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|**nullableProperty** | **String** | | [optional] |
## Enum: TypeEnum
| Name | Value |
|---- | -----|
| CHILDWITHNULLABLE | &quot;ChildWithNullable&quot; |

View File

@ -8,6 +8,7 @@ import org.openapitools.client.Pair;
import javax.ws.rs.core.GenericType;
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;
@ -853,6 +854,48 @@ if (param2 != null)
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
/**
* test nullable parent property
*
* @param childWithNullable request body (required)
* @throws ApiException if fails to make API call
*/
public void testNullable(ChildWithNullable childWithNullable) throws ApiException {
Object localVarPostBody = childWithNullable;
// verify the required parameter 'childWithNullable' is set
if (childWithNullable == null) {
throw new ApiException(400, "Missing the required parameter 'childWithNullable' when calling testNullable");
}
// create path and map variables
String localVarPath = "/fake/nullable".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
/**
*
* To test the collection format in query parameters

View File

@ -0,0 +1,140 @@
/*
* 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 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
@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 ");
}
}

View File

@ -0,0 +1,203 @@
/*
* 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 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
@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
@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 ");
}
}

View File

@ -0,0 +1,68 @@
/*
* 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 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
}
}

View File

@ -0,0 +1,62 @@
/*
* 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 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
}
}

View File

@ -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
@ -95,6 +97,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
@ -127,6 +130,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

View File

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

View File

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

View File

@ -0,0 +1,13 @@
# ChildWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**otherProperty** | **String** | | [optional] |

View File

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

View File

@ -0,0 +1,22 @@
# ParentWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|**nullableProperty** | **String** | | [optional] |
## Enum: TypeEnum
| Name | Value |
|---- | -----|
| CHILDWITHNULLABLE | &quot;ChildWithNullable&quot; |

View File

@ -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;
@ -971,6 +972,51 @@ public class FakeApi {
ParameterizedTypeReference<Void> localReturnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/jsonFormData", HttpMethod.GET, Collections.<String, Object>emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);
}
/**
* test nullable parent property
*
* <p><b>200</b> - successful operation
* @param childWithNullable request body (required)
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void testNullable(ChildWithNullable childWithNullable) throws RestClientException {
testNullableWithHttpInfo(childWithNullable);
}
/**
* test nullable parent property
*
* <p><b>200</b> - successful operation
* @param childWithNullable request body (required)
* @return ResponseEntity&lt;Void&gt;
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ResponseEntity<Void> testNullableWithHttpInfo(ChildWithNullable childWithNullable) throws RestClientException {
Object localVarPostBody = childWithNullable;
// verify the required parameter 'childWithNullable' is set
if (childWithNullable == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'childWithNullable' when calling testNullable");
}
final MultiValueMap<String, String> localVarQueryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders localVarHeaderParams = new HttpHeaders();
final MultiValueMap<String, String> localVarCookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap<String, Object> localVarFormParams = 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> localReturnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/nullable", HttpMethod.POST, Collections.<String, Object>emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);
}
/**
*
* To test the collection format in query parameters

View File

@ -0,0 +1,150 @@
/*
* 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 org.openapitools.client.model.ParentWithNullable;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.dataformat.xml.annotation.*;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.*;
import io.github.threetenjaxb.core.*;
/**
* 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)
@XmlRootElement(name = "ChildWithNullable")
@XmlAccessorType(XmlAccessType.FIELD)
@JacksonXmlRootElement(localName = "ChildWithNullable")
public class ChildWithNullable extends ParentWithNullable {
public static final String JSON_PROPERTY_OTHER_PROPERTY = "otherProperty";
@XmlElement(name = "otherProperty")
private String otherProperty;
public ChildWithNullable() {
}
public ChildWithNullable otherProperty(String otherProperty) {
this.otherProperty = otherProperty;
return this;
}
/**
* Get otherProperty
* @return otherProperty
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_OTHER_PROPERTY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@JacksonXmlProperty(localName = "otherProperty")
public String getOtherProperty() {
return otherProperty;
}
@JsonProperty(JSON_PROPERTY_OTHER_PROPERTY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@JacksonXmlProperty(localName = "otherProperty")
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 ");
}
}

View File

@ -0,0 +1,218 @@
/*
* 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 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;
import com.fasterxml.jackson.dataformat.xml.annotation.*;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.*;
import io.github.threetenjaxb.core.*;
/**
* 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"),
})
@XmlRootElement(name = "ParentWithNullable")
@XmlAccessorType(XmlAccessType.FIELD)
@JacksonXmlRootElement(localName = "ParentWithNullable")
public class ParentWithNullable {
/**
* Gets or Sets type
*/
@XmlType(name="TypeEnum")
@XmlEnum(String.class)
public enum TypeEnum {
@XmlEnumValue("ChildWithNullable")
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";
@XmlElement(name = "type")
protected TypeEnum type;
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";
@XmlElement(name = "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
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@JacksonXmlProperty(localName = "type")
public TypeEnum getType() {
return type;
}
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@JacksonXmlProperty(localName = "type")
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
@JsonIgnore
public String getNullableProperty() {
return nullableProperty.orElse(null);
}
@JsonProperty(JSON_PROPERTY_NULLABLE_PROPERTY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@JacksonXmlProperty(localName = "nullableProperty")
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 ");
}
}

View File

@ -0,0 +1,68 @@
/*
* 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 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
}
}

View File

@ -0,0 +1,62 @@
/*
* 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 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
}
}

View File

@ -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
@ -95,6 +97,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
@ -127,6 +130,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

View File

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

View File

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

View File

@ -0,0 +1,13 @@
# ChildWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**otherProperty** | **String** | | [optional] |

View File

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

View File

@ -0,0 +1,22 @@
# ParentWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|**nullableProperty** | **String** | | [optional] |
## Enum: TypeEnum
| Name | Value |
|---- | -----|
| CHILDWITHNULLABLE | &quot;ChildWithNullable&quot; |

View File

@ -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;
@ -971,6 +972,51 @@ public class FakeApi {
ParameterizedTypeReference<Void> localReturnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/jsonFormData", HttpMethod.GET, Collections.<String, Object>emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);
}
/**
* test nullable parent property
*
* <p><b>200</b> - successful operation
* @param childWithNullable request body (required)
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void testNullable(ChildWithNullable childWithNullable) throws RestClientException {
testNullableWithHttpInfo(childWithNullable);
}
/**
* test nullable parent property
*
* <p><b>200</b> - successful operation
* @param childWithNullable request body (required)
* @return ResponseEntity&lt;Void&gt;
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ResponseEntity<Void> testNullableWithHttpInfo(ChildWithNullable childWithNullable) throws RestClientException {
Object localVarPostBody = childWithNullable;
// verify the required parameter 'childWithNullable' is set
if (childWithNullable == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'childWithNullable' when calling testNullable");
}
final MultiValueMap<String, String> localVarQueryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders localVarHeaderParams = new HttpHeaders();
final MultiValueMap<String, String> localVarCookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap<String, Object> localVarFormParams = 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> localReturnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI("/fake/nullable", HttpMethod.POST, Collections.<String, Object>emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);
}
/**
*
* To test the collection format in query parameters

View File

@ -0,0 +1,140 @@
/*
* 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 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
@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 ");
}
}

View File

@ -0,0 +1,203 @@
/*
* 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 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
@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
@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 ");
}
}

View File

@ -0,0 +1,68 @@
/*
* 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 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
}
}

View File

@ -0,0 +1,62 @@
/*
* 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 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
}
}

View File

@ -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
@ -113,6 +115,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
@ -145,6 +148,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

View File

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

View File

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

View File

@ -0,0 +1,13 @@
# ChildWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**otherProperty** | **String** | | [optional] |

View File

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

View File

@ -0,0 +1,22 @@
# ParentWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|**nullableProperty** | **String** | | [optional] |
## Enum: TypeEnum
| Name | Value |
|---- | -----|
| CHILDWITHNULLABLE | &quot;ChildWithNullable&quot; |

View File

@ -3,6 +3,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import io.vertx.core.file.AsyncFile;
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;
@ -90,6 +91,10 @@ public interface FakeApi {
void testJsonFormData(String param, String param2, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Void>> handler);
void testNullable(ChildWithNullable childWithNullable, Handler<AsyncResult<Void>> handler);
void testNullable(ChildWithNullable childWithNullable, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Void>> handler);
void testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, Map<String, String> language, Handler<AsyncResult<Void>> handler);
void testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, Map<String, String> language, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Void>> handler);

View File

@ -2,6 +2,7 @@ package org.openapitools.client.api;
import io.vertx.core.file.AsyncFile;
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;
@ -964,6 +965,54 @@ if (param2 != null) localVarFormParams.put("param2", param2);
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler);
}
/**
* test nullable parent property
*
* @param childWithNullable request body (required)
* @param resultHandler Asynchronous result handler
*/
public void testNullable(ChildWithNullable childWithNullable, Handler<AsyncResult<Void>> resultHandler) {
testNullable(childWithNullable, null, resultHandler);
}
/**
* test nullable parent property
*
* @param childWithNullable request body (required)
* @param authInfo per call authentication override.
* @param resultHandler Asynchronous result handler
*/
public void testNullable(ChildWithNullable childWithNullable, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Void>> resultHandler) {
Object localVarBody = childWithNullable;
// verify the required parameter 'childWithNullable' is set
if (childWithNullable == null) {
resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'childWithNullable' when calling testNullable"));
return;
}
// create path and map variables
String localVarPath = "/fake/nullable";
// query params
List<Pair> localVarQueryParams = new ArrayList<>();
// header params
MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap();
// cookie params
MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap();
// form params
// TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client)
Map<String, Object> localVarFormParams = new HashMap<>();
String[] localVarAccepts = { };
String[] localVarContentTypes = { "application/json" };
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler);
}
/**
*
* To test the collection format in query parameters
* @param pipe (required)

View File

@ -2,6 +2,7 @@ package org.openapitools.client.api.rxjava;
import io.vertx.core.file.AsyncFile;
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;
@ -912,6 +913,51 @@ public class FakeApi {
));
}
/**
* test nullable parent property
*
* @param childWithNullable request body (required)
* @param resultHandler Asynchronous result handler
*/
public void testNullable(ChildWithNullable childWithNullable, Handler<AsyncResult<Void>> resultHandler) {
delegate.testNullable(childWithNullable, resultHandler);
}
/**
* test nullable parent property
*
* @param childWithNullable request body (required)
* @param authInfo call specific auth overrides
* @param resultHandler Asynchronous result handler
*/
public void testNullable(ChildWithNullable childWithNullable, ApiClient.AuthInfo authInfo, Handler<AsyncResult<Void>> resultHandler) {
delegate.testNullable(childWithNullable, authInfo, resultHandler);
}
/**
* test nullable parent property
*
* @param childWithNullable request body (required)
* @return Asynchronous result handler (RxJava Single)
*/
public Single<Void> rxTestNullable(ChildWithNullable childWithNullable) {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut ->
delegate.testNullable(childWithNullable, fut)
));
}
/**
* test nullable parent property
*
* @param childWithNullable request body (required)
* @param authInfo call specific auth overrides
* @return Asynchronous result handler (RxJava Single)
*/
public Single<Void> rxTestNullable(ChildWithNullable childWithNullable, ApiClient.AuthInfo authInfo) {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut ->
delegate.testNullable(childWithNullable, authInfo, fut)
));
}
/**
*
* To test the collection format in query parameters
* @param pipe (required)

View File

@ -0,0 +1,140 @@
/*
* 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 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
@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 ");
}
}

View File

@ -0,0 +1,203 @@
/*
* 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 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
@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
@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 ");
}
}

View File

@ -0,0 +1,68 @@
/*
* 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 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
}
}

View File

@ -0,0 +1,62 @@
/*
* 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 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
}
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,13 @@
# ChildWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**otherProperty** | **String** | | [optional] |

View File

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

View File

@ -0,0 +1,22 @@
# ParentWithNullable
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|**nullableProperty** | **String** | | [optional] |
## Enum: TypeEnum
| Name | Value |
|---- | -----|
| CHILDWITHNULLABLE | &quot;ChildWithNullable&quot; |

View File

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

View File

@ -0,0 +1,140 @@
/*
* 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 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
})
@jakarta.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
**/
@jakarta.annotation.Nullable
@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 ");
}
}

View File

@ -0,0 +1,203 @@
/*
* 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 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
})
@jakarta.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
**/
@jakarta.annotation.Nullable
@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
**/
@jakarta.annotation.Nullable
@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 ");
}
}

View File

@ -0,0 +1,68 @@
/*
* 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 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
}
}

View File

@ -0,0 +1,62 @@
/*
* 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 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
}
}

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