[BUG][JAVA] oneOf/anyOf multiple constructors with same erasure #18548 (#18645)

* [BUG][JAVA] oneOf/anyOf multiple constructors with same erasure
#18548

* [BUG][JAVA] oneOf/anyOf multiple constructors with same erasure
#18548
This commit is contained in:
Max
2024-05-13 10:33:49 +02:00
committed by GitHub
parent 0e05cf26d9
commit cefeded745
37 changed files with 1049 additions and 167 deletions

View File

@@ -54,8 +54,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isArray}}
{{#isArray}}
final Type typeInstance = new TypeToken<{{{dataType}}}>(){}.getType();
final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance));
final Type typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = new TypeToken<{{{dataType}}}>(){}.getType();
final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}));
{{/isArray}}
{{/anyOf}}
{{/composedSchemas}}
@@ -210,13 +210,11 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
}
{{#anyOf}}
public {{classname}}({{{.}}} o) {
public {{classname}}(Object o) {
super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
setActualInstance(o);
}
{{/anyOf}}
static {
{{#composedSchemas}}
{{#anyOf}}

View File

@@ -56,12 +56,12 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isArray}}
{{#isArray}}
final Type typeInstance = new TypeToken<{{{dataType}}}>(){}.getType();
final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance));
final Type typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = new TypeToken<{{{dataType}}}>(){}.getType();
final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}));
{{/isArray}}
{{#isMap}}
final Type typeInstance = new TypeToken<{{{dataType}}}>(){}.getType();
final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance));
final Type typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = new TypeToken<{{{dataType}}}>(){}.getType();
final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}));
{{/isMap}}
{{/oneOf}}
{{/composedSchemas}}
@@ -288,13 +288,11 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
}
{{#oneOf}}
public {{classname}}({{{.}}} o) {
public {{classname}}(Object o) {
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
setActualInstance(o);
}
{{/oneOf}}
static {
{{#composedSchemas}}
{{#oneOf}}

View File

@@ -938,6 +938,38 @@ paths:
$ref: '#/components/schemas/FreeFormObject'
description: request body
required: true
/fake/oneOfWIthSameErasure:
get:
description: Test route, this shouldn't cause a compiler error
responses:
200:
description: successful response
content:
application/json:
schema:
oneOf:
- type: array
items:
type: string
- type: array
items:
type: integer
/fake/anyOfWIthSameErasure:
get:
description: Test route, this shouldn't cause a compiler error
responses:
200:
description: successful response
content:
application/json:
schema:
anyOf:
- type: array
items:
type: string
- type: array
items:
type: integer
/fake/stringMap-reference:
post:
tags:

View File

@@ -124,7 +124,7 @@ public class MyExamplePostRequest extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public MyExamplePostRequest(String o) {
public MyExamplePostRequest(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -146,12 +146,7 @@ public class SimpleOneOf extends AbstractOpenApiSchema implements Serializable {
super("oneOf", Boolean.FALSE);
}
public SimpleOneOf(Integer o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public SimpleOneOf(String o) {
public SimpleOneOf(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -145,12 +145,7 @@ public class OneOfStringOrInt extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public OneOfStringOrInt(Integer o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public OneOfStringOrInt(String o) {
public OneOfStringOrInt(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -140,12 +140,7 @@ public class StringOrInt extends AbstractOpenApiSchema {
super("anyOf", Boolean.FALSE);
}
public StringOrInt(Integer o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}
public StringOrInt(String o) {
public StringOrInt(Object o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -42,8 +42,10 @@ docs/EnumClass.md
docs/EnumStringDiscriminator.md
docs/EnumTest.md
docs/EquilateralTriangle.md
docs/FakeAnyOfWIthSameErasureGet200Response.md
docs/FakeApi.md
docs/FakeClassnameTags123Api.md
docs/FakeOneOfWIthSameErasureGet200Response.md
docs/FileSchemaTestClass.md
docs/Foo.md
docs/FooGetDefaultResponse.md
@@ -185,6 +187,8 @@ src/main/java/org/openapitools/client/model/EnumClass.java
src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java
src/main/java/org/openapitools/client/model/EnumTest.java
src/main/java/org/openapitools/client/model/EquilateralTriangle.java
src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java
src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java
src/main/java/org/openapitools/client/model/FileSchemaTestClass.java
src/main/java/org/openapitools/client/model/Foo.java
src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java

View File

@@ -118,6 +118,8 @@ Class | Method | HTTP request | Description
*AnotherFakeApi* | [**getParameterArrayNumber**](docs/AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value
*AnotherFakeApi* | [**getParameterStringNumber**](docs/AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number
*AnotherFakeApi* | [**nullRequestBody**](docs/AnotherFakeApi.md#nullRequestBody) | **GET** /fake/null-request-body | null request body
*DefaultApi* | [**fakeAnyOfWIthSameErasureGet**](docs/DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure |
*DefaultApi* | [**fakeOneOfWIthSameErasureGet**](docs/DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure |
*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo |
*FakeApi* | [**fakeGetFreeFormObjectGet**](docs/FakeApi.md#fakeGetFreeFormObjectGet) | **GET** /fake/get-free-form-object |
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
@@ -202,6 +204,8 @@ Class | Method | HTTP request | Description
- [EnumStringDiscriminator](docs/EnumStringDiscriminator.md)
- [EnumTest](docs/EnumTest.md)
- [EquilateralTriangle](docs/EquilateralTriangle.md)
- [FakeAnyOfWIthSameErasureGet200Response](docs/FakeAnyOfWIthSameErasureGet200Response.md)
- [FakeOneOfWIthSameErasureGet200Response](docs/FakeOneOfWIthSameErasureGet200Response.md)
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
- [Foo](docs/Foo.md)
- [FooGetDefaultResponse](docs/FooGetDefaultResponse.md)

View File

@@ -992,6 +992,30 @@ paths:
x-content-type: application/json
x-accepts:
- application/json
/fake/oneOfWIthSameErasure:
get:
description: "Test route, this shouldn't cause a compiler error"
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/_fake_oneOfWIthSameErasure_get_200_response'
description: successful response
x-accepts:
- application/json
/fake/anyOfWIthSameErasure:
get:
description: "Test route, this shouldn't cause a compiler error"
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/_fake_anyOfWIthSameErasure_get_200_response'
description: successful response
x-accepts:
- application/json
/fake/stringMap-reference:
post:
description: ""
@@ -2887,6 +2911,22 @@ components:
- param
- param2
type: object
_fake_oneOfWIthSameErasure_get_200_response:
oneOf:
- items:
type: string
type: array
- items:
type: integer
type: array
_fake_anyOfWIthSameErasure_get_200_response:
anyOf:
- items:
type: string
type: array
- items:
type: integer
type: array
testInlineFreeformAdditionalProperties_request:
additionalProperties: true
properties:

View File

@@ -4,9 +4,127 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**fakeAnyOfWIthSameErasureGet**](DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure | |
| [**fakeOneOfWIthSameErasureGet**](DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure | |
| [**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | |
<a id="fakeAnyOfWIthSameErasureGet"></a>
# **fakeAnyOfWIthSameErasureGet**
> FakeAnyOfWIthSameErasureGet200Response fakeAnyOfWIthSameErasureGet()
Test route, this shouldn&#39;t cause a compiler error
### 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.DefaultApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
DefaultApi apiInstance = new DefaultApi(defaultClient);
try {
FakeAnyOfWIthSameErasureGet200Response result = apiInstance.fakeAnyOfWIthSameErasureGet();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#fakeAnyOfWIthSameErasureGet");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**FakeAnyOfWIthSameErasureGet200Response**](FakeAnyOfWIthSameErasureGet200Response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | successful response | - |
<a id="fakeOneOfWIthSameErasureGet"></a>
# **fakeOneOfWIthSameErasureGet**
> FakeOneOfWIthSameErasureGet200Response fakeOneOfWIthSameErasureGet()
Test route, this shouldn&#39;t cause a compiler error
### 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.DefaultApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
DefaultApi apiInstance = new DefaultApi(defaultClient);
try {
FakeOneOfWIthSameErasureGet200Response result = apiInstance.fakeOneOfWIthSameErasureGet();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#fakeOneOfWIthSameErasureGet");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**FakeOneOfWIthSameErasureGet200Response**](FakeOneOfWIthSameErasureGet200Response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | successful response | - |
<a id="fooGet"></a>
# **fooGet**
> FooGetDefaultResponse fooGet()

View File

@@ -0,0 +1,12 @@
# FakeAnyOfWIthSameErasureGet200Response
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|

View File

@@ -0,0 +1,12 @@
# FakeOneOfWIthSameErasureGet200Response
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|

View File

@@ -269,6 +269,8 @@ public class JSON {
gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.EnumStringDiscriminator.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.EnumTest.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.EquilateralTriangle.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FakeAnyOfWIthSameErasureGet200Response.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FakeOneOfWIthSameErasureGet200Response.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FileSchemaTestClass.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Foo.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FooGetDefaultResponse.CustomTypeAdapterFactory());

View File

@@ -27,6 +27,8 @@ import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import org.openapitools.client.model.FakeAnyOfWIthSameErasureGet200Response;
import org.openapitools.client.model.FakeOneOfWIthSameErasureGet200Response;
import org.openapitools.client.model.FooGetDefaultResponse;
import java.lang.reflect.Type;
@@ -72,6 +74,232 @@ public class DefaultApi {
this.localCustomBaseUrl = customBaseUrl;
}
/**
* Build call for fakeAnyOfWIthSameErasureGet
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> successful response </td><td> - </td></tr>
</table>
*/
public okhttp3.Call fakeAnyOfWIthSameErasureGetCall(final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/fake/anyOfWIthSameErasure";
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>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call fakeAnyOfWIthSameErasureGetValidateBeforeCall(final ApiCallback _callback) throws ApiException {
return fakeAnyOfWIthSameErasureGetCall(_callback);
}
/**
*
* Test route, this shouldn&#39;t cause a compiler error
* @return FakeAnyOfWIthSameErasureGet200Response
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> successful response </td><td> - </td></tr>
</table>
*/
public FakeAnyOfWIthSameErasureGet200Response fakeAnyOfWIthSameErasureGet() throws ApiException {
ApiResponse<FakeAnyOfWIthSameErasureGet200Response> localVarResp = fakeAnyOfWIthSameErasureGetWithHttpInfo();
return localVarResp.getData();
}
/**
*
* Test route, this shouldn&#39;t cause a compiler error
* @return ApiResponse&lt;FakeAnyOfWIthSameErasureGet200Response&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> successful response </td><td> - </td></tr>
</table>
*/
public ApiResponse<FakeAnyOfWIthSameErasureGet200Response> fakeAnyOfWIthSameErasureGetWithHttpInfo() throws ApiException {
okhttp3.Call localVarCall = fakeAnyOfWIthSameErasureGetValidateBeforeCall(null);
Type localVarReturnType = new TypeToken<FakeAnyOfWIthSameErasureGet200Response>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* (asynchronously)
* Test route, this shouldn&#39;t cause a compiler error
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> successful response </td><td> - </td></tr>
</table>
*/
public okhttp3.Call fakeAnyOfWIthSameErasureGetAsync(final ApiCallback<FakeAnyOfWIthSameErasureGet200Response> _callback) throws ApiException {
okhttp3.Call localVarCall = fakeAnyOfWIthSameErasureGetValidateBeforeCall(_callback);
Type localVarReturnType = new TypeToken<FakeAnyOfWIthSameErasureGet200Response>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for fakeOneOfWIthSameErasureGet
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> successful response </td><td> - </td></tr>
</table>
*/
public okhttp3.Call fakeOneOfWIthSameErasureGetCall(final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/fake/oneOfWIthSameErasure";
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>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call fakeOneOfWIthSameErasureGetValidateBeforeCall(final ApiCallback _callback) throws ApiException {
return fakeOneOfWIthSameErasureGetCall(_callback);
}
/**
*
* Test route, this shouldn&#39;t cause a compiler error
* @return FakeOneOfWIthSameErasureGet200Response
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> successful response </td><td> - </td></tr>
</table>
*/
public FakeOneOfWIthSameErasureGet200Response fakeOneOfWIthSameErasureGet() throws ApiException {
ApiResponse<FakeOneOfWIthSameErasureGet200Response> localVarResp = fakeOneOfWIthSameErasureGetWithHttpInfo();
return localVarResp.getData();
}
/**
*
* Test route, this shouldn&#39;t cause a compiler error
* @return ApiResponse&lt;FakeOneOfWIthSameErasureGet200Response&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> successful response </td><td> - </td></tr>
</table>
*/
public ApiResponse<FakeOneOfWIthSameErasureGet200Response> fakeOneOfWIthSameErasureGetWithHttpInfo() throws ApiException {
okhttp3.Call localVarCall = fakeOneOfWIthSameErasureGetValidateBeforeCall(null);
Type localVarReturnType = new TypeToken<FakeOneOfWIthSameErasureGet200Response>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* (asynchronously)
* Test route, this shouldn&#39;t cause a compiler error
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> successful response </td><td> - </td></tr>
</table>
*/
public okhttp3.Call fakeOneOfWIthSameErasureGetAsync(final ApiCallback<FakeOneOfWIthSameErasureGet200Response> _callback) throws ApiException {
okhttp3.Call localVarCall = fakeOneOfWIthSameErasureGetValidateBeforeCall(_callback);
Type localVarReturnType = new TypeToken<FakeOneOfWIthSameErasureGet200Response>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for fooGet
* @param _callback Callback for upload/download progress

View File

@@ -155,12 +155,7 @@ public class AllOfModelArrayAnyOfAllOfAttributesC extends AbstractOpenApiSchema
super("oneOf", Boolean.FALSE);
}
public AllOfModelArrayAnyOfAllOfAttributesC(Order o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public AllOfModelArrayAnyOfAllOfAttributesC(Pet o) {
public AllOfModelArrayAnyOfAllOfAttributesC(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -146,12 +146,7 @@ public class AllOfModelArrayAnyOfAllOfLinkListColumn1Value extends AbstractOpenA
super("anyOf", Boolean.FALSE);
}
public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(Tag o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}
public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(User o) {
public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(Object o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -65,8 +65,8 @@ public class ArrayAnyOf extends AbstractOpenApiSchema {
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<Integer> adapterInteger = gson.getDelegateAdapter(this, TypeToken.get(Integer.class));
final Type typeInstance = new TypeToken<List<String>>(){}.getType();
final TypeAdapter<List<String>> adapterListString = (TypeAdapter<List<String>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance));
final Type typeInstanceListString = new TypeToken<List<String>>(){}.getType();
final TypeAdapter<List<String>> adapterListString = (TypeAdapter<List<String>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstanceListString));
return (TypeAdapter<T>) new TypeAdapter<ArrayAnyOf>() {
@Override
@@ -151,12 +151,7 @@ public class ArrayAnyOf extends AbstractOpenApiSchema {
super("anyOf", Boolean.FALSE);
}
public ArrayAnyOf(Integer o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}
public ArrayAnyOf(List<String> o) {
public ArrayAnyOf(Object o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -65,8 +65,8 @@ public class ArrayOneOf extends AbstractOpenApiSchema {
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<Integer> adapterInteger = gson.getDelegateAdapter(this, TypeToken.get(Integer.class));
final Type typeInstance = new TypeToken<List<String>>(){}.getType();
final TypeAdapter<List<String>> adapterListString = (TypeAdapter<List<String>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance));
final Type typeInstanceListString = new TypeToken<List<String>>(){}.getType();
final TypeAdapter<List<String>> adapterListString = (TypeAdapter<List<String>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstanceListString));
return (TypeAdapter<T>) new TypeAdapter<ArrayOneOf>() {
@Override
@@ -156,12 +156,7 @@ public class ArrayOneOf extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public ArrayOneOf(Integer o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public ArrayOneOf(List<String> o) {
public ArrayOneOf(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -0,0 +1,241 @@
/*
* 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.List;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.JsonPrimitive;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonArray;
import com.google.gson.JsonParseException;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
public class FakeAnyOfWIthSameErasureGet200Response extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(FakeAnyOfWIthSameErasureGet200Response.class.getName());
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!FakeAnyOfWIthSameErasureGet200Response.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'FakeAnyOfWIthSameErasureGet200Response' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final Type typeInstanceListString = new TypeToken<List<String>>(){}.getType();
final TypeAdapter<List<String>> adapterListString = (TypeAdapter<List<String>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstanceListString));
final Type typeInstanceListInteger = new TypeToken<List<Integer>>(){}.getType();
final TypeAdapter<List<Integer>> adapterListInteger = (TypeAdapter<List<Integer>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstanceListInteger));
return (TypeAdapter<T>) new TypeAdapter<FakeAnyOfWIthSameErasureGet200Response>() {
@Override
public void write(JsonWriter out, FakeAnyOfWIthSameErasureGet200Response value) throws IOException {
if (value == null || value.getActualInstance() == null) {
elementAdapter.write(out, null);
return;
}
// check if the actual instance is of the type `List<String>`
if (value.getActualInstance() instanceof List<?>) {
JsonPrimitive primitive = adapterListString.toJsonTree((List<String>)value.getActualInstance()).getAsJsonPrimitive();
elementAdapter.write(out, primitive);
return;
}
throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: List<Integer>, List<String>");
}
@Override
public FakeAnyOfWIthSameErasureGet200Response read(JsonReader in) throws IOException {
Object deserialized = null;
JsonElement jsonElement = elementAdapter.read(in);
ArrayList<String> errorMessages = new ArrayList<>();
TypeAdapter actualAdapter = elementAdapter;
// deserialize List<String>
try {
// validate the JSON object to see if any exception is thrown
if (!jsonElement.isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
}
JsonArray array = jsonElement.getAsJsonArray();
// validate array items
for(JsonElement element : array) {
if (!element.getAsJsonPrimitive().isString()) {
throw new IllegalArgumentException(String.format("Expected array items to be of type String in the JSON string but got `%s`", jsonElement.toString()));
}
}
actualAdapter = adapterListString;
FakeAnyOfWIthSameErasureGet200Response ret = new FakeAnyOfWIthSameErasureGet200Response();
ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement));
return ret;
} catch (Exception e) {
// deserialization failed, continue
errorMessages.add(String.format("Deserialization for List<String> failed with `%s`.", e.getMessage()));
log.log(Level.FINER, "Input data does not match schema 'List<String>'", e);
}
throw new IOException(String.format("Failed deserialization for FakeAnyOfWIthSameErasureGet200Response: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString()));
}
}.nullSafe();
}
}
// store a list of schema names defined in anyOf
public static final Map<String, Class<?>> schemas = new HashMap<String, Class<?>>();
public FakeAnyOfWIthSameErasureGet200Response() {
super("anyOf", Boolean.FALSE);
}
public FakeAnyOfWIthSameErasureGet200Response(Object o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("List<String>", List.class);
}
@Override
public Map<String, Class<?>> getSchemas() {
return FakeAnyOfWIthSameErasureGet200Response.schemas;
}
/**
* Set the instance that matches the anyOf child schema, check
* the instance parameter is valid against the anyOf child schemas:
* List<Integer>, List<String>
*
* It could be an instance of the 'anyOf' schemas.
*/
@Override
public void setActualInstance(Object instance) {
if (instance instanceof List<?>) {
List<?> list = (List<?>) instance;
if (list.get(0) instanceof String) {
super.setActualInstance(instance);
return;
}
}
throw new RuntimeException("Invalid instance type. Must be List<Integer>, List<String>");
}
/**
* Get the actual instance, which can be the following:
* List<Integer>, List<String>
*
* @return The actual instance (List<Integer>, List<String>)
*/
@SuppressWarnings("unchecked")
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `List<String>`. If the actual instance is not `List<String>`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `List<String>`
* @throws ClassCastException if the instance is not `List<String>`
*/
public List<String> getListString() throws ClassCastException {
return (List<String>)super.getActualInstance();
}
/**
* Validates the JSON Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to FakeAnyOfWIthSameErasureGet200Response
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
// validate anyOf schemas one by one
ArrayList<String> errorMessages = new ArrayList<>();
// validate the json string with List<String>
try {
if (!jsonElement.isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
}
JsonArray array = jsonElement.getAsJsonArray();
// validate array items
for(JsonElement element : array) {
if (!element.getAsJsonPrimitive().isString()) {
throw new IllegalArgumentException(String.format("Expected array items to be of type String in the JSON string but got `%s`", jsonElement.toString()));
}
}
return;
} catch (Exception e) {
errorMessages.add(String.format("Deserialization for List<String> failed with `%s`.", e.getMessage()));
// continue to the next one
}
throw new IOException(String.format("The JSON string is invalid for FakeAnyOfWIthSameErasureGet200Response with anyOf schemas: List<Integer>, List<String>. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString()));
}
/**
* Create an instance of FakeAnyOfWIthSameErasureGet200Response given an JSON string
*
* @param jsonString JSON string
* @return An instance of FakeAnyOfWIthSameErasureGet200Response
* @throws IOException if the JSON string is invalid with respect to FakeAnyOfWIthSameErasureGet200Response
*/
public static FakeAnyOfWIthSameErasureGet200Response fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, FakeAnyOfWIthSameErasureGet200Response.class);
}
/**
* Convert an instance of FakeAnyOfWIthSameErasureGet200Response to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View File

@@ -0,0 +1,250 @@
/*
* 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.List;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.JsonPrimitive;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonArray;
import com.google.gson.JsonParseException;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
public class FakeOneOfWIthSameErasureGet200Response extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(FakeOneOfWIthSameErasureGet200Response.class.getName());
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!FakeOneOfWIthSameErasureGet200Response.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'FakeOneOfWIthSameErasureGet200Response' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final Type typeInstanceListString = new TypeToken<List<String>>(){}.getType();
final TypeAdapter<List<String>> adapterListString = (TypeAdapter<List<String>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstanceListString));
final Type typeInstanceListInteger = new TypeToken<List<Integer>>(){}.getType();
final TypeAdapter<List<Integer>> adapterListInteger = (TypeAdapter<List<Integer>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstanceListInteger));
return (TypeAdapter<T>) new TypeAdapter<FakeOneOfWIthSameErasureGet200Response>() {
@Override
public void write(JsonWriter out, FakeOneOfWIthSameErasureGet200Response value) throws IOException {
if (value == null || value.getActualInstance() == null) {
elementAdapter.write(out, null);
return;
}
// check if the actual instance is of the type `List<String>`
if (value.getActualInstance() instanceof List<?>) {
JsonPrimitive primitive = adapterListString.toJsonTree((List<String>)value.getActualInstance()).getAsJsonPrimitive();
elementAdapter.write(out, primitive);
return;
}
throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: List<Integer>, List<String>");
}
@Override
public FakeOneOfWIthSameErasureGet200Response read(JsonReader in) throws IOException {
Object deserialized = null;
JsonElement jsonElement = elementAdapter.read(in);
int match = 0;
ArrayList<String> errorMessages = new ArrayList<>();
TypeAdapter actualAdapter = elementAdapter;
// deserialize List<String>
try {
// validate the JSON object to see if any exception is thrown
if (!jsonElement.isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
}
JsonArray array = jsonElement.getAsJsonArray();
// validate array items
for(JsonElement element : array) {
if (!element.getAsJsonPrimitive().isString()) {
throw new IllegalArgumentException(String.format("Expected array items to be of type String in the JSON string but got `%s`", jsonElement.toString()));
}
}
actualAdapter = adapterListString;
match++;
log.log(Level.FINER, "Input data matches schema 'List<String>'");
} catch (Exception e) {
// deserialization failed, continue
errorMessages.add(String.format("Deserialization for List<String> failed with `%s`.", e.getMessage()));
log.log(Level.FINER, "Input data does not match schema 'List<String>'", e);
}
if (match == 1) {
FakeOneOfWIthSameErasureGet200Response ret = new FakeOneOfWIthSameErasureGet200Response();
ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement));
return ret;
}
throw new IOException(String.format("Failed deserialization for FakeOneOfWIthSameErasureGet200Response: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString()));
}
}.nullSafe();
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<String, Class<?>>();
public FakeOneOfWIthSameErasureGet200Response() {
super("oneOf", Boolean.FALSE);
}
public FakeOneOfWIthSameErasureGet200Response(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("List<String>", List.class);
}
@Override
public Map<String, Class<?>> getSchemas() {
return FakeOneOfWIthSameErasureGet200Response.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* List<Integer>, List<String>
*
* It could be an instance of the 'oneOf' schemas.
*/
@Override
public void setActualInstance(Object instance) {
if (instance instanceof List<?>) {
List<?> list = (List<?>) instance;
if (list.get(0) instanceof String) {
super.setActualInstance(instance);
return;
}
}
throw new RuntimeException("Invalid instance type. Must be List<Integer>, List<String>");
}
/**
* Get the actual instance, which can be the following:
* List<Integer>, List<String>
*
* @return The actual instance (List<Integer>, List<String>)
*/
@SuppressWarnings("unchecked")
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `List<String>`. If the actual instance is not `List<String>`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `List<String>`
* @throws ClassCastException if the instance is not `List<String>`
*/
public List<String> getListString() throws ClassCastException {
return (List<String>)super.getActualInstance();
}
/**
* Validates the JSON Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to FakeOneOfWIthSameErasureGet200Response
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
// validate oneOf schemas one by one
int validCount = 0;
ArrayList<String> errorMessages = new ArrayList<>();
// validate the json string with List<String>
try {
if (!jsonElement.isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
}
JsonArray array = jsonElement.getAsJsonArray();
// validate array items
for(JsonElement element : array) {
if (!element.getAsJsonPrimitive().isString()) {
throw new IllegalArgumentException(String.format("Expected array items to be of type String in the JSON string but got `%s`", jsonElement.toString()));
}
}
validCount++;
} catch (Exception e) {
errorMessages.add(String.format("Deserialization for List<String> failed with `%s`.", e.getMessage()));
// continue to the next one
}
if (validCount != 1) {
throw new IOException(String.format("The JSON string is invalid for FakeOneOfWIthSameErasureGet200Response with oneOf schemas: List<Integer>, List<String>. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString()));
}
}
/**
* Create an instance of FakeOneOfWIthSameErasureGet200Response given an JSON string
*
* @param jsonString JSON string
* @return An instance of FakeOneOfWIthSameErasureGet200Response
* @throws IOException if the JSON string is invalid with respect to FakeOneOfWIthSameErasureGet200Response
*/
public static FakeOneOfWIthSameErasureGet200Response fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, FakeOneOfWIthSameErasureGet200Response.class);
}
/**
* Convert an instance of FakeOneOfWIthSameErasureGet200Response to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View File

@@ -64,8 +64,8 @@ public class FreeFormObjectTestClassProperties extends AbstractOpenApiSchema {
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<String> adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class));
final Type typeInstance = new TypeToken<Map<String, Object>>(){}.getType();
final TypeAdapter<Map<String, Object>> adapterMapStringObject = (TypeAdapter<Map<String, Object>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance));
final Type typeInstanceMapStringObject = new TypeToken<Map<String, Object>>(){}.getType();
final TypeAdapter<Map<String, Object>> adapterMapStringObject = (TypeAdapter<Map<String, Object>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstanceMapStringObject));
return (TypeAdapter<T>) new TypeAdapter<FreeFormObjectTestClassProperties>() {
@Override
@@ -148,12 +148,7 @@ public class FreeFormObjectTestClassProperties extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public FreeFormObjectTestClassProperties(Map<String, Object> o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public FreeFormObjectTestClassProperties(String o) {
public FreeFormObjectTestClassProperties(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -151,12 +151,7 @@ public class Fruit extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public Fruit(Apple o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Fruit(Banana o) {
public Fruit(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -151,12 +151,7 @@ public class FruitReq extends AbstractOpenApiSchema {
super("oneOf", Boolean.TRUE);
}
public FruitReq(AppleReq o) {
super("oneOf", Boolean.TRUE);
setActualInstance(o);
}
public FruitReq(BananaReq o) {
public FruitReq(Object o) {
super("oneOf", Boolean.TRUE);
setActualInstance(o);
}

View File

@@ -146,12 +146,7 @@ public class GmFruit extends AbstractOpenApiSchema {
super("anyOf", Boolean.FALSE);
}
public GmFruit(Apple o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}
public GmFruit(Banana o) {
public GmFruit(Object o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -196,17 +196,7 @@ public class Mammal extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public Mammal(Pig o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Mammal(Whale o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Mammal(Zebra o) {
public Mammal(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -172,12 +172,7 @@ public class NullableShape extends AbstractOpenApiSchema {
super("oneOf", Boolean.TRUE);
}
public NullableShape(Quadrilateral o) {
super("oneOf", Boolean.TRUE);
setActualInstance(o);
}
public NullableShape(Triangle o) {
public NullableShape(Object o) {
super("oneOf", Boolean.TRUE);
setActualInstance(o);
}

View File

@@ -172,12 +172,7 @@ public class Pig extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public Pig(BasquePig o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Pig(DanishPig o) {
public Pig(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -172,12 +172,7 @@ public class Quadrilateral extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public Quadrilateral(ComplexQuadrilateral o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Quadrilateral(SimpleQuadrilateral o) {
public Quadrilateral(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -167,17 +167,7 @@ public class Scalar extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public Scalar(BigDecimal o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Scalar(Boolean o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Scalar(String o) {
public Scalar(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -163,17 +163,7 @@ public class ScalarAnyOf extends AbstractOpenApiSchema {
super("anyOf", Boolean.FALSE);
}
public ScalarAnyOf(BigDecimal o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}
public ScalarAnyOf(Boolean o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}
public ScalarAnyOf(String o) {
public ScalarAnyOf(Object o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -172,12 +172,7 @@ public class Shape extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public Shape(Quadrilateral o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Shape(Triangle o) {
public Shape(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -172,12 +172,7 @@ public class ShapeOrNull extends AbstractOpenApiSchema {
super("oneOf", Boolean.TRUE);
}
public ShapeOrNull(Quadrilateral o) {
super("oneOf", Boolean.TRUE);
setActualInstance(o);
}
public ShapeOrNull(Triangle o) {
public ShapeOrNull(Object o) {
super("oneOf", Boolean.TRUE);
setActualInstance(o);
}

View File

@@ -196,17 +196,7 @@ public class Triangle extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public Triangle(EquilateralTriangle o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Triangle(IsoscelesTriangle o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Triangle(ScaleneTriangle o) {
public Triangle(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -66,8 +66,8 @@ public class Value extends AbstractOpenApiSchema {
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<Scalar> adapterScalar = gson.getDelegateAdapter(this, TypeToken.get(Scalar.class));
final Type typeInstance = new TypeToken<List<Scalar>>(){}.getType();
final TypeAdapter<List<Scalar>> adapterListScalar = (TypeAdapter<List<Scalar>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance));
final Type typeInstanceListScalar = new TypeToken<List<Scalar>>(){}.getType();
final TypeAdapter<List<Scalar>> adapterListScalar = (TypeAdapter<List<Scalar>>) gson.getDelegateAdapter(this, TypeToken.get(typeInstanceListScalar));
return (TypeAdapter<T>) new TypeAdapter<Value>() {
@Override
@@ -156,12 +156,7 @@ public class Value extends AbstractOpenApiSchema {
super("oneOf", Boolean.FALSE);
}
public Value(List<Scalar> o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Value(Scalar o) {
public Value(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

View File

@@ -0,0 +1,34 @@
/*
* 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.List;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for FakeAnyOfWIthSameErasureGet200Response
*/
public class FakeAnyOfWIthSameErasureGet200ResponseTest {
private final FakeAnyOfWIthSameErasureGet200Response model = new FakeAnyOfWIthSameErasureGet200Response();
/**
* Model tests for FakeAnyOfWIthSameErasureGet200Response
*/
@Test
public void testFakeAnyOfWIthSameErasureGet200Response() {
// TODO: test FakeAnyOfWIthSameErasureGet200Response
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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.List;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for FakeOneOfWIthSameErasureGet200Response
*/
public class FakeOneOfWIthSameErasureGet200ResponseTest {
private final FakeOneOfWIthSameErasureGet200Response model = new FakeOneOfWIthSameErasureGet200Response();
/**
* Model tests for FakeOneOfWIthSameErasureGet200Response
*/
@Test
public void testFakeOneOfWIthSameErasureGet200Response() {
// TODO: test FakeOneOfWIthSameErasureGet200Response
}
}