[java][native] Fix urlQuery string method in oneOf (#14488)

* better tests, fix oneOf in urlquery string method

* update samples

* update
This commit is contained in:
William Cheng
2023-01-20 01:57:32 +08:00
committed by GitHub
parent 6e780218ad
commit 4ecb9f4186
230 changed files with 23706 additions and 1753 deletions

View File

@@ -19,15 +19,13 @@ import org.openapitools.client.Pair;
import java.math.BigDecimal;
import org.openapitools.client.model.Client;
import org.openapitools.client.model.EnumClass;
import java.io.File;
import org.openapitools.client.model.FileSchemaTestClass;
import org.openapitools.client.model.HealthCheckResult;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.OuterObjectWithEnumProperty;
import org.openapitools.client.model.Pet;
import org.openapitools.client.model.OuterEnum;
import org.openapitools.client.model.User;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -172,111 +170,6 @@ public class FakeApi {
}
return localVarRequestBuilder;
}
/**
* test http signature authentication
*
* @param pet Pet object that needs to be added to the store (required)
* @param query1 query parameter (optional)
* @param header1 header parameter (optional)
* @return CompletableFuture<Void>
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> fakeHttpSignatureTest(Pet pet, String query1, String header1) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = fakeHttpSignatureTestRequestBuilder(pet, query1, header1);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("fakeHttpSignatureTest", localVarResponse));
}
return CompletableFuture.completedFuture(null);
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* test http signature authentication
*
* @param pet Pet object that needs to be added to the store (required)
* @param query1 query parameter (optional)
* @param header1 header parameter (optional)
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> fakeHttpSignatureTestWithHttpInfo(Pet pet, String query1, String header1) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = fakeHttpSignatureTestRequestBuilder(pet, query1, header1);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("fakeHttpSignatureTest", localVarResponse));
}
return CompletableFuture.completedFuture(
new ApiResponse<Void>(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder fakeHttpSignatureTestRequestBuilder(Pet pet, String query1, String header1) throws ApiException {
// verify the required parameter 'pet' is set
if (pet == null) {
throw new ApiException(400, "Missing the required parameter 'pet' when calling fakeHttpSignatureTest");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/fake/http-signature-test";
List<Pair> localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "query_1";
localVarQueryParams.addAll(ApiClient.parameterToPairs("query_1", query1));
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
if (localVarQueryStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryStringJoiner.toString());
}
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
if (header1 != null) {
localVarRequestBuilder.header("header_1", header1.toString());
}
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet);
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
*
* Test serialization of outer boolean types
@@ -649,25 +542,24 @@ public class FakeApi {
return localVarRequestBuilder;
}
/**
* Array of Enums
*
* Test serialization of enum (int) properties with examples
* @param outerObjectWithEnumProperty Input enum (int) as post body (required)
* @return CompletableFuture&lt;OuterObjectWithEnumProperty&gt;
* @return CompletableFuture&lt;List&lt;OuterEnum&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<OuterObjectWithEnumProperty> fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) throws ApiException {
public CompletableFuture<List<OuterEnum>> getArrayOfEnums() throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = fakePropertyEnumIntegerSerializeRequestBuilder(outerObjectWithEnumProperty);
HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder();
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("fakePropertyEnumIntegerSerialize", localVarResponse));
return CompletableFuture.failedFuture(getApiException("getArrayOfEnums", localVarResponse));
}
try {
String responseBody = localVarResponse.body();
return CompletableFuture.completedFuture(
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<OuterObjectWithEnumProperty>() {})
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<List<OuterEnum>>() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
@@ -680,15 +572,14 @@ public class FakeApi {
}
/**
* Array of Enums
*
* Test serialization of enum (int) properties with examples
* @param outerObjectWithEnumProperty Input enum (int) as post body (required)
* @return CompletableFuture&lt;ApiResponse&lt;OuterObjectWithEnumProperty&gt;&gt;
* @return CompletableFuture&lt;ApiResponse&lt;List&lt;OuterEnum&gt;&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<OuterObjectWithEnumProperty>> fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty) throws ApiException {
public CompletableFuture<ApiResponse<List<OuterEnum>>> getArrayOfEnumsWithHttpInfo() throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = fakePropertyEnumIntegerSerializeRequestBuilder(outerObjectWithEnumProperty);
HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder();
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -696,15 +587,15 @@ public class FakeApi {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("fakePropertyEnumIntegerSerialize", localVarResponse));
return CompletableFuture.failedFuture(getApiException("getArrayOfEnums", localVarResponse));
}
try {
String responseBody = localVarResponse.body();
return CompletableFuture.completedFuture(
new ApiResponse<OuterObjectWithEnumProperty>(
new ApiResponse<List<OuterEnum>>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<OuterObjectWithEnumProperty>() {}))
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<List<OuterEnum>>() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
@@ -717,110 +608,17 @@ public class FakeApi {
}
}
private HttpRequest.Builder fakePropertyEnumIntegerSerializeRequestBuilder(OuterObjectWithEnumProperty outerObjectWithEnumProperty) throws ApiException {
// verify the required parameter 'outerObjectWithEnumProperty' is set
if (outerObjectWithEnumProperty == null) {
throw new ApiException(400, "Missing the required parameter 'outerObjectWithEnumProperty' when calling fakePropertyEnumIntegerSerialize");
}
private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/fake/property/enum-int";
String localVarPath = "/fake/array-of-enums";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "*/*");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(outerObjectWithEnumProperty);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
*
* For this test, the body has to be a binary file.
* @param body image to upload (required)
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> testBodyWithBinary(File body) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testBodyWithBinaryRequestBuilder(body);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("testBodyWithBinary", localVarResponse));
}
return CompletableFuture.completedFuture(null);
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
*
* For this test, the body has to be a binary file.
* @param body image to upload (required)
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> testBodyWithBinaryWithHttpInfo(File body) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testBodyWithBinaryRequestBuilder(body);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("testBodyWithBinary", localVarResponse));
}
return CompletableFuture.completedFuture(
new ApiResponse<Void>(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder testBodyWithBinaryRequestBuilder(File body) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithBinary");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/fake/body-with-binary";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "image/png");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
@@ -831,7 +629,7 @@ public class FakeApi {
}
/**
*
* For this test, the body for this request must reference a schema named &#x60;File&#x60;.
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
* @param fileSchemaTestClass (required)
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
@@ -855,7 +653,7 @@ public class FakeApi {
/**
*
* For this test, the body for this request must reference a schema named &#x60;File&#x60;.
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
* @param fileSchemaTestClass (required)
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
@@ -1128,7 +926,7 @@ public class FakeApi {
* @param string None (optional)
* @param binary None (optional)
* @param date None (optional)
* @param dateTime None (optional)
* @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00)
* @param password None (optional)
* @param paramCallback None (optional)
* @return CompletableFuture&lt;Void&gt;
@@ -1165,7 +963,7 @@ public class FakeApi {
* @param string None (optional)
* @param binary None (optional)
* @param date None (optional)
* @param dateTime None (optional)
* @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00)
* @param password None (optional)
* @param paramCallback None (optional)
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
@@ -1238,15 +1036,14 @@ public class FakeApi {
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
* @param enumQueryInteger Query parameter enum test (double) (optional)
* @param enumQueryDouble Query parameter enum test (double) (optional)
* @param enumQueryModelArray (optional
* @param enumFormStringArray Form parameter enum test (string array) (optional
* @param enumFormString Form parameter enum test (string) (optional, default to -efg)
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<EnumClass> enumQueryModelArray, List<String> enumFormStringArray, String enumFormString) throws ApiException {
public CompletableFuture<Void> testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString);
HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -1270,15 +1067,14 @@ public class FakeApi {
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
* @param enumQueryInteger Query parameter enum test (double) (optional)
* @param enumQueryDouble Query parameter enum test (double) (optional)
* @param enumQueryModelArray (optional
* @param enumFormStringArray Form parameter enum test (string array) (optional
* @param enumFormString Form parameter enum test (string) (optional, default to -efg)
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> testEnumParametersWithHttpInfo(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<EnumClass> enumQueryModelArray, List<String> enumFormStringArray, String enumFormString) throws ApiException {
public CompletableFuture<ApiResponse<Void>> testEnumParametersWithHttpInfo(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString);
HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -1299,7 +1095,7 @@ public class FakeApi {
}
}
private HttpRequest.Builder testEnumParametersRequestBuilder(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<EnumClass> enumQueryModelArray, List<String> enumFormStringArray, String enumFormString) throws ApiException {
private HttpRequest.Builder testEnumParametersRequestBuilder(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -1316,8 +1112,6 @@ public class FakeApi {
localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_integer", enumQueryInteger));
localVarQueryParameterBaseName = "enum_query_double";
localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_double", enumQueryDouble));
localVarQueryParameterBaseName = "enum_query_model_array";
localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "enum_query_model_array", enumQueryModelArray));
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
@@ -1754,14 +1548,12 @@ public class FakeApi {
* @param http (required)
* @param url (required)
* @param context (required)
* @param allowEmpty (required)
* @param language (optional
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, Map<String, String> language) throws ApiException {
public CompletableFuture<Void> testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context, allowEmpty, language);
HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -1784,14 +1576,12 @@ public class FakeApi {
* @param http (required)
* @param url (required)
* @param context (required)
* @param allowEmpty (required)
* @param language (optional
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> testQueryParameterCollectionFormatWithHttpInfo(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, Map<String, String> language) throws ApiException {
public CompletableFuture<ApiResponse<Void>> testQueryParameterCollectionFormatWithHttpInfo(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context, allowEmpty, language);
HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -1812,7 +1602,7 @@ public class FakeApi {
}
}
private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, Map<String, String> language) throws ApiException {
private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException {
// verify the required parameter 'pipe' is set
if (pipe == null) {
throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat");
@@ -1833,10 +1623,6 @@ public class FakeApi {
if (context == null) {
throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat");
}
// verify the required parameter 'allowEmpty' is set
if (allowEmpty == null) {
throw new ApiException(400, "Missing the required parameter 'allowEmpty' when calling testQueryParameterCollectionFormat");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -1846,7 +1632,7 @@ public class FakeApi {
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "pipe";
localVarQueryParams.addAll(ApiClient.parameterToPairs("pipes", "pipe", pipe));
localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "pipe", pipe));
localVarQueryParameterBaseName = "ioutil";
localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "ioutil", ioutil));
localVarQueryParameterBaseName = "http";
@@ -1855,10 +1641,6 @@ public class FakeApi {
localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "url", url));
localVarQueryParameterBaseName = "context";
localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "context", context));
localVarQueryParameterBaseName = "language";
localVarQueryParams.addAll(ApiClient.parameterToPairs("language", language));
localVarQueryParameterBaseName = "allowEmpty";
localVarQueryParams.addAll(ApiClient.parameterToPairs("allowEmpty", allowEmpty));
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");

View File

@@ -20,7 +20,6 @@ import org.openapitools.client.Pair;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import java.util.Set;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -355,12 +354,12 @@ public class PetApi {
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @return CompletableFuture&lt;Set&lt;Pet&gt;&gt;
* @return CompletableFuture&lt;List&lt;Pet&gt;&gt;
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public CompletableFuture<Set<Pet>> findPetsByTags(Set<String> tags) throws ApiException {
public CompletableFuture<List<Pet>> findPetsByTags(List<String> tags) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags);
return memberVarHttpClient.sendAsync(
@@ -372,7 +371,7 @@ public class PetApi {
try {
String responseBody = localVarResponse.body();
return CompletableFuture.completedFuture(
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Set<Pet>>() {})
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<List<Pet>>() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
@@ -388,12 +387,12 @@ public class PetApi {
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @return CompletableFuture&lt;ApiResponse&lt;Set&lt;Pet&gt;&gt;&gt;
* @return CompletableFuture&lt;ApiResponse&lt;List&lt;Pet&gt;&gt;&gt;
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public CompletableFuture<ApiResponse<Set<Pet>>> findPetsByTagsWithHttpInfo(Set<String> tags) throws ApiException {
public CompletableFuture<ApiResponse<List<Pet>>> findPetsByTagsWithHttpInfo(List<String> tags) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags);
return memberVarHttpClient.sendAsync(
@@ -408,10 +407,10 @@ public class PetApi {
try {
String responseBody = localVarResponse.body();
return CompletableFuture.completedFuture(
new ApiResponse<Set<Pet>>(
new ApiResponse<List<Pet>>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Set<Pet>>() {}))
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<List<Pet>>() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
@@ -424,7 +423,7 @@ public class PetApi {
}
}
private HttpRequest.Builder findPetsByTagsRequestBuilder(Set<String> tags) throws ApiException {
private HttpRequest.Builder findPetsByTagsRequestBuilder(List<String> tags) throws ApiException {
// verify the required parameter 'tags' is set
if (tags == null) {
throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags");

View File

@@ -27,6 +27,10 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;
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;
@@ -35,7 +39,13 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
*/
@JsonPropertyOrder({
AdditionalPropertiesClass.JSON_PROPERTY_MAP_PROPERTY,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY
AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY,
AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE1,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3,
AdditionalPropertiesClass.JSON_PROPERTY_EMPTY_MAP,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesClass {
@@ -45,6 +55,24 @@ public class AdditionalPropertiesClass {
public static final String JSON_PROPERTY_MAP_OF_MAP_PROPERTY = "map_of_map_property";
private Map<String, Map<String, String>> mapOfMapProperty = null;
public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1";
private JsonNullable<Object> anytype1 = JsonNullable.<Object>of(null);
public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1 = "map_with_undeclared_properties_anytype_1";
private Object mapWithUndeclaredPropertiesAnytype1;
public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2 = "map_with_undeclared_properties_anytype_2";
private Object mapWithUndeclaredPropertiesAnytype2;
public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3 = "map_with_undeclared_properties_anytype_3";
private Map<String, Object> mapWithUndeclaredPropertiesAnytype3 = null;
public static final String JSON_PROPERTY_EMPTY_MAP = "empty_map";
private Object emptyMap;
public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING = "map_with_undeclared_properties_string";
private Map<String, String> mapWithUndeclaredPropertiesString = null;
public AdditionalPropertiesClass() {
}
@@ -114,6 +142,180 @@ public class AdditionalPropertiesClass {
}
public AdditionalPropertiesClass anytype1(Object anytype1) {
this.anytype1 = JsonNullable.<Object>of(anytype1);
return this;
}
/**
* Get anytype1
* @return anytype1
**/
@javax.annotation.Nullable
@JsonIgnore
public Object getAnytype1() {
return anytype1.orElse(null);
}
@JsonProperty(JSON_PROPERTY_ANYTYPE1)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Object> getAnytype1_JsonNullable() {
return anytype1;
}
@JsonProperty(JSON_PROPERTY_ANYTYPE1)
public void setAnytype1_JsonNullable(JsonNullable<Object> anytype1) {
this.anytype1 = anytype1;
}
public void setAnytype1(Object anytype1) {
this.anytype1 = JsonNullable.<Object>of(anytype1);
}
public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype1(Object mapWithUndeclaredPropertiesAnytype1) {
this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1;
return this;
}
/**
* Get mapWithUndeclaredPropertiesAnytype1
* @return mapWithUndeclaredPropertiesAnytype1
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Object getMapWithUndeclaredPropertiesAnytype1() {
return mapWithUndeclaredPropertiesAnytype1;
}
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setMapWithUndeclaredPropertiesAnytype1(Object mapWithUndeclaredPropertiesAnytype1) {
this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1;
}
public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype2(Object mapWithUndeclaredPropertiesAnytype2) {
this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2;
return this;
}
/**
* Get mapWithUndeclaredPropertiesAnytype2
* @return mapWithUndeclaredPropertiesAnytype2
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Object getMapWithUndeclaredPropertiesAnytype2() {
return mapWithUndeclaredPropertiesAnytype2;
}
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setMapWithUndeclaredPropertiesAnytype2(Object mapWithUndeclaredPropertiesAnytype2) {
this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2;
}
public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype3(Map<String, Object> mapWithUndeclaredPropertiesAnytype3) {
this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3;
return this;
}
public AdditionalPropertiesClass putMapWithUndeclaredPropertiesAnytype3Item(String key, Object mapWithUndeclaredPropertiesAnytype3Item) {
if (this.mapWithUndeclaredPropertiesAnytype3 == null) {
this.mapWithUndeclaredPropertiesAnytype3 = new HashMap<>();
}
this.mapWithUndeclaredPropertiesAnytype3.put(key, mapWithUndeclaredPropertiesAnytype3Item);
return this;
}
/**
* Get mapWithUndeclaredPropertiesAnytype3
* @return mapWithUndeclaredPropertiesAnytype3
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3)
@JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS)
public Map<String, Object> getMapWithUndeclaredPropertiesAnytype3() {
return mapWithUndeclaredPropertiesAnytype3;
}
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3)
@JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS)
public void setMapWithUndeclaredPropertiesAnytype3(Map<String, Object> mapWithUndeclaredPropertiesAnytype3) {
this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3;
}
public AdditionalPropertiesClass emptyMap(Object emptyMap) {
this.emptyMap = emptyMap;
return this;
}
/**
* an object with no declared properties and no undeclared properties, hence it&#39;s an empty map.
* @return emptyMap
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_EMPTY_MAP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Object getEmptyMap() {
return emptyMap;
}
@JsonProperty(JSON_PROPERTY_EMPTY_MAP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setEmptyMap(Object emptyMap) {
this.emptyMap = emptyMap;
}
public AdditionalPropertiesClass mapWithUndeclaredPropertiesString(Map<String, String> mapWithUndeclaredPropertiesString) {
this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString;
return this;
}
public AdditionalPropertiesClass putMapWithUndeclaredPropertiesStringItem(String key, String mapWithUndeclaredPropertiesStringItem) {
if (this.mapWithUndeclaredPropertiesString == null) {
this.mapWithUndeclaredPropertiesString = new HashMap<>();
}
this.mapWithUndeclaredPropertiesString.put(key, mapWithUndeclaredPropertiesStringItem);
return this;
}
/**
* Get mapWithUndeclaredPropertiesString
* @return mapWithUndeclaredPropertiesString
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Map<String, String> getMapWithUndeclaredPropertiesString() {
return mapWithUndeclaredPropertiesString;
}
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setMapWithUndeclaredPropertiesString(Map<String, String> mapWithUndeclaredPropertiesString) {
this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString;
}
/**
* Return true if this AdditionalPropertiesClass object is equal to o.
*/
@@ -127,12 +329,29 @@ public class AdditionalPropertiesClass {
}
AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o;
return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) &&
Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty);
Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty) &&
equalsNullable(this.anytype1, additionalPropertiesClass.anytype1) &&
Objects.equals(this.mapWithUndeclaredPropertiesAnytype1, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype1) &&
Objects.equals(this.mapWithUndeclaredPropertiesAnytype2, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype2) &&
Objects.equals(this.mapWithUndeclaredPropertiesAnytype3, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype3) &&
Objects.equals(this.emptyMap, additionalPropertiesClass.emptyMap) &&
Objects.equals(this.mapWithUndeclaredPropertiesString, additionalPropertiesClass.mapWithUndeclaredPropertiesString);
}
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(mapProperty, mapOfMapProperty);
return Objects.hash(mapProperty, mapOfMapProperty, hashCodeNullable(anytype1), mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, emptyMap, mapWithUndeclaredPropertiesString);
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
@@ -141,6 +360,12 @@ public class AdditionalPropertiesClass {
sb.append("class AdditionalPropertiesClass {\n");
sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n");
sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n");
sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n");
sb.append(" mapWithUndeclaredPropertiesAnytype1: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype1)).append("\n");
sb.append(" mapWithUndeclaredPropertiesAnytype2: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype2)).append("\n");
sb.append(" mapWithUndeclaredPropertiesAnytype3: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype3)).append("\n");
sb.append(" emptyMap: ").append(toIndentedString(emptyMap)).append("\n");
sb.append(" mapWithUndeclaredPropertiesString: ").append(toIndentedString(mapWithUndeclaredPropertiesString)).append("\n");
sb.append("}");
return sb.toString();
}
@@ -206,6 +431,44 @@ public class AdditionalPropertiesClass {
}
}
// add `anytype_1` to the URL query string
if (getAnytype1() != null) {
joiner.add(String.format("%sanytype_1%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getAnytype1()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `map_with_undeclared_properties_anytype_1` to the URL query string
if (getMapWithUndeclaredPropertiesAnytype1() != null) {
joiner.add(String.format("%smap_with_undeclared_properties_anytype_1%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getMapWithUndeclaredPropertiesAnytype1()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `map_with_undeclared_properties_anytype_2` to the URL query string
if (getMapWithUndeclaredPropertiesAnytype2() != null) {
joiner.add(String.format("%smap_with_undeclared_properties_anytype_2%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getMapWithUndeclaredPropertiesAnytype2()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `map_with_undeclared_properties_anytype_3` to the URL query string
if (getMapWithUndeclaredPropertiesAnytype3() != null) {
for (String _key : getMapWithUndeclaredPropertiesAnytype3().keySet()) {
joiner.add(String.format("%smap_with_undeclared_properties_anytype_3%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
getMapWithUndeclaredPropertiesAnytype3().get(_key), URLEncoder.encode(String.valueOf(getMapWithUndeclaredPropertiesAnytype3().get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
// add `empty_map` to the URL query string
if (getEmptyMap() != null) {
joiner.add(String.format("%sempty_map%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getEmptyMap()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `map_with_undeclared_properties_string` to the URL query string
if (getMapWithUndeclaredPropertiesString() != null) {
for (String _key : getMapWithUndeclaredPropertiesString().keySet()) {
joiner.add(String.format("%smap_with_undeclared_properties_string%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
getMapWithUndeclaredPropertiesString().get(_key), URLEncoder.encode(String.valueOf(getMapWithUndeclaredPropertiesString().get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,186 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Apple
*/
@JsonPropertyOrder({
Apple.JSON_PROPERTY_CULTIVAR,
Apple.JSON_PROPERTY_ORIGIN
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Apple {
public static final String JSON_PROPERTY_CULTIVAR = "cultivar";
private String cultivar;
public static final String JSON_PROPERTY_ORIGIN = "origin";
private String origin;
public Apple() {
}
public Apple cultivar(String cultivar) {
this.cultivar = cultivar;
return this;
}
/**
* Get cultivar
* @return cultivar
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_CULTIVAR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getCultivar() {
return cultivar;
}
@JsonProperty(JSON_PROPERTY_CULTIVAR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setCultivar(String cultivar) {
this.cultivar = cultivar;
}
public Apple origin(String origin) {
this.origin = origin;
return this;
}
/**
* Get origin
* @return origin
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ORIGIN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getOrigin() {
return origin;
}
@JsonProperty(JSON_PROPERTY_ORIGIN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setOrigin(String origin) {
this.origin = origin;
}
/**
* Return true if this apple object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Apple apple = (Apple) o;
return Objects.equals(this.cultivar, apple.cultivar) &&
Objects.equals(this.origin, apple.origin);
}
@Override
public int hashCode() {
return Objects.hash(cultivar, origin);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Apple {\n");
sb.append(" cultivar: ").append(toIndentedString(cultivar)).append("\n");
sb.append(" origin: ").append(toIndentedString(origin)).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 `cultivar` to the URL query string
if (getCultivar() != null) {
joiner.add(String.format("%scultivar%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getCultivar()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `origin` to the URL query string
if (getOrigin() != null) {
joiner.add(String.format("%sorigin%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getOrigin()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,186 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* AppleReq
*/
@JsonPropertyOrder({
AppleReq.JSON_PROPERTY_CULTIVAR,
AppleReq.JSON_PROPERTY_MEALY
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AppleReq {
public static final String JSON_PROPERTY_CULTIVAR = "cultivar";
private String cultivar;
public static final String JSON_PROPERTY_MEALY = "mealy";
private Boolean mealy;
public AppleReq() {
}
public AppleReq cultivar(String cultivar) {
this.cultivar = cultivar;
return this;
}
/**
* Get cultivar
* @return cultivar
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_CULTIVAR)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getCultivar() {
return cultivar;
}
@JsonProperty(JSON_PROPERTY_CULTIVAR)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setCultivar(String cultivar) {
this.cultivar = cultivar;
}
public AppleReq mealy(Boolean mealy) {
this.mealy = mealy;
return this;
}
/**
* Get mealy
* @return mealy
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MEALY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getMealy() {
return mealy;
}
@JsonProperty(JSON_PROPERTY_MEALY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setMealy(Boolean mealy) {
this.mealy = mealy;
}
/**
* Return true if this appleReq object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AppleReq appleReq = (AppleReq) o;
return Objects.equals(this.cultivar, appleReq.cultivar) &&
Objects.equals(this.mealy, appleReq.mealy);
}
@Override
public int hashCode() {
return Objects.hash(cultivar, mealy);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AppleReq {\n");
sb.append(" cultivar: ").append(toIndentedString(cultivar)).append("\n");
sb.append(" mealy: ").append(toIndentedString(mealy)).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 `cultivar` to the URL query string
if (getCultivar() != null) {
joiner.add(String.format("%scultivar%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getCultivar()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `mealy` to the URL query string
if (getMealy() != null) {
joiner.add(String.format("%smealy%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getMealy()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,151 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Banana
*/
@JsonPropertyOrder({
Banana.JSON_PROPERTY_LENGTH_CM
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Banana {
public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm";
private BigDecimal lengthCm;
public Banana() {
}
public Banana lengthCm(BigDecimal lengthCm) {
this.lengthCm = lengthCm;
return this;
}
/**
* Get lengthCm
* @return lengthCm
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_LENGTH_CM)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public BigDecimal getLengthCm() {
return lengthCm;
}
@JsonProperty(JSON_PROPERTY_LENGTH_CM)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setLengthCm(BigDecimal lengthCm) {
this.lengthCm = lengthCm;
}
/**
* Return true if this banana object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Banana banana = (Banana) o;
return Objects.equals(this.lengthCm, banana.lengthCm);
}
@Override
public int hashCode() {
return Objects.hash(lengthCm);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Banana {\n");
sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).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 `lengthCm` to the URL query string
if (getLengthCm() != null) {
joiner.add(String.format("%slengthCm%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getLengthCm()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,187 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* BananaReq
*/
@JsonPropertyOrder({
BananaReq.JSON_PROPERTY_LENGTH_CM,
BananaReq.JSON_PROPERTY_SWEET
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class BananaReq {
public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm";
private BigDecimal lengthCm;
public static final String JSON_PROPERTY_SWEET = "sweet";
private Boolean sweet;
public BananaReq() {
}
public BananaReq lengthCm(BigDecimal lengthCm) {
this.lengthCm = lengthCm;
return this;
}
/**
* Get lengthCm
* @return lengthCm
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_LENGTH_CM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public BigDecimal getLengthCm() {
return lengthCm;
}
@JsonProperty(JSON_PROPERTY_LENGTH_CM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setLengthCm(BigDecimal lengthCm) {
this.lengthCm = lengthCm;
}
public BananaReq sweet(Boolean sweet) {
this.sweet = sweet;
return this;
}
/**
* Get sweet
* @return sweet
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SWEET)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getSweet() {
return sweet;
}
@JsonProperty(JSON_PROPERTY_SWEET)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSweet(Boolean sweet) {
this.sweet = sweet;
}
/**
* Return true if this bananaReq object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BananaReq bananaReq = (BananaReq) o;
return Objects.equals(this.lengthCm, bananaReq.lengthCm) &&
Objects.equals(this.sweet, bananaReq.sweet);
}
@Override
public int hashCode() {
return Objects.hash(lengthCm, sweet);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BananaReq {\n");
sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).append("\n");
sb.append(" sweet: ").append(toIndentedString(sweet)).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 `lengthCm` to the URL query string
if (getLengthCm() != null) {
joiner.add(String.format("%slengthCm%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getLengthCm()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `sweet` to the URL query string
if (getSweet() != null) {
joiner.add(String.format("%ssweet%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSweet()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* BasquePig
*/
@JsonPropertyOrder({
BasquePig.JSON_PROPERTY_CLASS_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class BasquePig {
public static final String JSON_PROPERTY_CLASS_NAME = "className";
private String className;
public BasquePig() {
}
public BasquePig className(String className) {
this.className = className;
return this;
}
/**
* Get className
* @return className
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getClassName() {
return className;
}
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setClassName(String className) {
this.className = className;
}
/**
* Return true if this BasquePig object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BasquePig basquePig = (BasquePig) o;
return Objects.equals(this.className, basquePig.className);
}
@Override
public int hashCode() {
return Objects.hash(className);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BasquePig {\n");
sb.append(" className: ").append(toIndentedString(className)).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 `className` to the URL query string
if (getClassName() != null) {
joiner.add(String.format("%sclassName%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClassName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,219 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
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.ParentPet;
import java.util.Set;
import java.util.HashSet;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.JSON;
/**
* ChildCat
*/
@JsonPropertyOrder({
ChildCat.JSON_PROPERTY_NAME,
ChildCat.JSON_PROPERTY_PET_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonIgnoreProperties(
value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the pet_type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true)
public class ChildCat extends ParentPet {
public static final String JSON_PROPERTY_NAME = "name";
private String name;
public static final String JSON_PROPERTY_PET_TYPE = "pet_type";
private String petType = "ChildCat";
public ChildCat() {
}
public ChildCat name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setName(String name) {
this.name = name;
}
public static final Set<String> PET_TYPE_VALUES = new HashSet<>(Arrays.asList(
"ChildCat"
));
public ChildCat petType(String petType) {
if (!PET_TYPE_VALUES.contains(petType)) {
throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES));
}
this.petType = petType;
return this;
}
/**
* Get petType
* @return petType
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getPetType() {
return petType;
}
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setPetType(String petType) {
if (!PET_TYPE_VALUES.contains(petType)) {
throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES));
}
this.petType = petType;
}
/**
* Return true if this ChildCat object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ChildCat childCat = (ChildCat) o;
return Objects.equals(this.name, childCat.name) &&
Objects.equals(this.petType, childCat.petType) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(name, petType, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ChildCat {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" petType: ").append(toIndentedString(petType)).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 `pet_type` to the URL query string
if (getPetType() != null) {
joiner.add(String.format("%spet_type%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getPetType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
static {
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("ChildCat", ChildCat.class);
JSON.registerDiscriminator(ChildCat.class, "pet_type", mappings);
}
}

View File

@@ -0,0 +1,200 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Set;
import java.util.HashSet;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* ChildCatAllOf
*/
@JsonPropertyOrder({
ChildCatAllOf.JSON_PROPERTY_NAME,
ChildCatAllOf.JSON_PROPERTY_PET_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ChildCatAllOf {
public static final String JSON_PROPERTY_NAME = "name";
private String name;
public static final String JSON_PROPERTY_PET_TYPE = "pet_type";
private String petType = "ChildCat";
public ChildCatAllOf() {
}
public ChildCatAllOf name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setName(String name) {
this.name = name;
}
public static final Set<String> PET_TYPE_VALUES = new HashSet<>(Arrays.asList(
"ChildCat"
));
public ChildCatAllOf petType(String petType) {
if (!PET_TYPE_VALUES.contains(petType)) {
throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES));
}
this.petType = petType;
return this;
}
/**
* Get petType
* @return petType
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getPetType() {
return petType;
}
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setPetType(String petType) {
if (!PET_TYPE_VALUES.contains(petType)) {
throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES));
}
this.petType = petType;
}
/**
* Return true if this ChildCat_allOf object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ChildCatAllOf childCatAllOf = (ChildCatAllOf) o;
return Objects.equals(this.name, childCatAllOf.name) &&
Objects.equals(this.petType, childCatAllOf.petType);
}
@Override
public int hashCode() {
return Objects.hash(name, petType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ChildCatAllOf {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" petType: ").append(toIndentedString(petType)).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 `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `pet_type` to the URL query string
if (getPetType() != null) {
joiner.add(String.format("%spet_type%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getPetType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,186 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* ComplexQuadrilateral
*/
@JsonPropertyOrder({
ComplexQuadrilateral.JSON_PROPERTY_SHAPE_TYPE,
ComplexQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ComplexQuadrilateral {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType";
private String quadrilateralType;
public ComplexQuadrilateral() {
}
public ComplexQuadrilateral shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public ComplexQuadrilateral quadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
return this;
}
/**
* Get quadrilateralType
* @return quadrilateralType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getQuadrilateralType() {
return quadrilateralType;
}
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setQuadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
}
/**
* Return true if this ComplexQuadrilateral object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ComplexQuadrilateral complexQuadrilateral = (ComplexQuadrilateral) o;
return Objects.equals(this.shapeType, complexQuadrilateral.shapeType) &&
Objects.equals(this.quadrilateralType, complexQuadrilateral.quadrilateralType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType, quadrilateralType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ComplexQuadrilateral {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n");
sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).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 `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `quadrilateralType` to the URL query string
if (getQuadrilateralType() != null) {
joiner.add(String.format("%squadrilateralType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getQuadrilateralType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* DanishPig
*/
@JsonPropertyOrder({
DanishPig.JSON_PROPERTY_CLASS_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class DanishPig {
public static final String JSON_PROPERTY_CLASS_NAME = "className";
private String className;
public DanishPig() {
}
public DanishPig className(String className) {
this.className = className;
return this;
}
/**
* Get className
* @return className
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getClassName() {
return className;
}
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setClassName(String className) {
this.className = className;
}
/**
* Return true if this DanishPig object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DanishPig danishPig = (DanishPig) o;
return Objects.equals(this.className, danishPig.className);
}
@Override
public int hashCode() {
return Objects.hash(className);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DanishPig {\n");
sb.append(" className: ").append(toIndentedString(className)).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 `className` to the URL query string
if (getClassName() != null) {
joiner.add(String.format("%sclassName%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClassName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,353 @@
/*
* 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.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.client.model.Fruit;
import org.openapitools.client.model.NullableShape;
import org.openapitools.client.model.Shape;
import org.openapitools.client.model.ShapeOrNull;
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;
/**
* Drawing
*/
@JsonPropertyOrder({
Drawing.JSON_PROPERTY_MAIN_SHAPE,
Drawing.JSON_PROPERTY_SHAPE_OR_NULL,
Drawing.JSON_PROPERTY_NULLABLE_SHAPE,
Drawing.JSON_PROPERTY_SHAPES
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Drawing extends HashMap<String, Fruit> {
public static final String JSON_PROPERTY_MAIN_SHAPE = "mainShape";
private Shape mainShape;
public static final String JSON_PROPERTY_SHAPE_OR_NULL = "shapeOrNull";
private ShapeOrNull shapeOrNull;
public static final String JSON_PROPERTY_NULLABLE_SHAPE = "nullableShape";
private JsonNullable<NullableShape> nullableShape = JsonNullable.<NullableShape>undefined();
public static final String JSON_PROPERTY_SHAPES = "shapes";
private List<Shape> shapes = null;
public Drawing() {
}
public Drawing mainShape(Shape mainShape) {
this.mainShape = mainShape;
return this;
}
/**
* Get mainShape
* @return mainShape
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MAIN_SHAPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Shape getMainShape() {
return mainShape;
}
@JsonProperty(JSON_PROPERTY_MAIN_SHAPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setMainShape(Shape mainShape) {
this.mainShape = mainShape;
}
public Drawing shapeOrNull(ShapeOrNull shapeOrNull) {
this.shapeOrNull = shapeOrNull;
return this;
}
/**
* Get shapeOrNull
* @return shapeOrNull
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public ShapeOrNull getShapeOrNull() {
return shapeOrNull;
}
@JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setShapeOrNull(ShapeOrNull shapeOrNull) {
this.shapeOrNull = shapeOrNull;
}
public Drawing nullableShape(NullableShape nullableShape) {
this.nullableShape = JsonNullable.<NullableShape>of(nullableShape);
return this;
}
/**
* Get nullableShape
* @return nullableShape
**/
@javax.annotation.Nullable
@JsonIgnore
public NullableShape getNullableShape() {
return nullableShape.orElse(null);
}
@JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<NullableShape> getNullableShape_JsonNullable() {
return nullableShape;
}
@JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE)
public void setNullableShape_JsonNullable(JsonNullable<NullableShape> nullableShape) {
this.nullableShape = nullableShape;
}
public void setNullableShape(NullableShape nullableShape) {
this.nullableShape = JsonNullable.<NullableShape>of(nullableShape);
}
public Drawing shapes(List<Shape> shapes) {
this.shapes = shapes;
return this;
}
public Drawing addShapesItem(Shape shapesItem) {
if (this.shapes == null) {
this.shapes = new ArrayList<>();
}
this.shapes.add(shapesItem);
return this;
}
/**
* Get shapes
* @return shapes
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SHAPES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<Shape> getShapes() {
return shapes;
}
@JsonProperty(JSON_PROPERTY_SHAPES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setShapes(List<Shape> shapes) {
this.shapes = shapes;
}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Fruit> additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
* @param key the name of the property
* @param value the value of the property
* @return self reference
*/
@JsonAnySetter
public Drawing putAdditionalProperty(String key, Fruit value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Fruit>();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) properties.
* @return the additional (undeclared) properties
*/
@JsonAnyGetter
public Map<String, Fruit> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
* @param key the name of the property
* @return the additional (undeclared) property with the specified name
*/
public Fruit getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
/**
* Return true if this Drawing object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Drawing drawing = (Drawing) o;
return Objects.equals(this.mainShape, drawing.mainShape) &&
Objects.equals(this.shapeOrNull, drawing.shapeOrNull) &&
equalsNullable(this.nullableShape, drawing.nullableShape) &&
Objects.equals(this.shapes, drawing.shapes)&&
Objects.equals(this.additionalProperties, drawing.additionalProperties) &&
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(mainShape, shapeOrNull, hashCodeNullable(nullableShape), shapes, super.hashCode(), additionalProperties);
}
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 Drawing {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" mainShape: ").append(toIndentedString(mainShape)).append("\n");
sb.append(" shapeOrNull: ").append(toIndentedString(shapeOrNull)).append("\n");
sb.append(" nullableShape: ").append(toIndentedString(nullableShape)).append("\n");
sb.append(" shapes: ").append(toIndentedString(shapes)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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 `mainShape` to the URL query string
if (getMainShape() != null) {
joiner.add(getMainShape().toUrlQueryString(prefix + "mainShape" + suffix));
}
// add `shapeOrNull` to the URL query string
if (getShapeOrNull() != null) {
joiner.add(getShapeOrNull().toUrlQueryString(prefix + "shapeOrNull" + suffix));
}
// add `nullableShape` to the URL query string
if (getNullableShape() != null) {
joiner.add(getNullableShape().toUrlQueryString(prefix + "nullableShape" + suffix));
}
// add `shapes` to the URL query string
if (getShapes() != null) {
for (int i = 0; i < getShapes().size(); i++) {
if (getShapes().get(i) != null) {
joiner.add(getShapes().get(i).toUrlQueryString(String.format("%sshapes%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
return joiner.toString();
}
}

View File

@@ -43,6 +43,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
EnumTest.JSON_PROPERTY_ENUM_STRING,
EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED,
EnumTest.JSON_PROPERTY_ENUM_INTEGER,
EnumTest.JSON_PROPERTY_ENUM_INTEGER_ONLY,
EnumTest.JSON_PROPERTY_ENUM_NUMBER,
EnumTest.JSON_PROPERTY_OUTER_ENUM,
EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER,
@@ -169,6 +170,44 @@ public class EnumTest {
public static final String JSON_PROPERTY_ENUM_INTEGER = "enum_integer";
private EnumIntegerEnum enumInteger;
/**
* Gets or Sets enumIntegerOnly
*/
public enum EnumIntegerOnlyEnum {
NUMBER_2(2),
NUMBER_MINUS_2(-2);
private Integer value;
EnumIntegerOnlyEnum(Integer value) {
this.value = value;
}
@JsonValue
public Integer getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static EnumIntegerOnlyEnum fromValue(Integer value) {
for (EnumIntegerOnlyEnum b : EnumIntegerOnlyEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_ENUM_INTEGER_ONLY = "enum_integer_only";
private EnumIntegerOnlyEnum enumIntegerOnly;
/**
* Gets or Sets enumNumber
*/
@@ -297,6 +336,31 @@ public class EnumTest {
}
public EnumTest enumIntegerOnly(EnumIntegerOnlyEnum enumIntegerOnly) {
this.enumIntegerOnly = enumIntegerOnly;
return this;
}
/**
* Get enumIntegerOnly
* @return enumIntegerOnly
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ENUM_INTEGER_ONLY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public EnumIntegerOnlyEnum getEnumIntegerOnly() {
return enumIntegerOnly;
}
@JsonProperty(JSON_PROPERTY_ENUM_INTEGER_ONLY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setEnumIntegerOnly(EnumIntegerOnlyEnum enumIntegerOnly) {
this.enumIntegerOnly = enumIntegerOnly;
}
public EnumTest enumNumber(EnumNumberEnum enumNumber) {
this.enumNumber = enumNumber;
return this;
@@ -445,6 +509,7 @@ public class EnumTest {
return Objects.equals(this.enumString, enumTest.enumString) &&
Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) &&
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
Objects.equals(this.enumIntegerOnly, enumTest.enumIntegerOnly) &&
Objects.equals(this.enumNumber, enumTest.enumNumber) &&
equalsNullable(this.outerEnum, enumTest.outerEnum) &&
Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) &&
@@ -458,7 +523,7 @@ public class EnumTest {
@Override
public int hashCode() {
return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, hashCodeNullable(outerEnum), outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue);
return Objects.hash(enumString, enumStringRequired, enumInteger, enumIntegerOnly, enumNumber, hashCodeNullable(outerEnum), outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue);
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
@@ -475,6 +540,7 @@ public class EnumTest {
sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n");
sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n");
sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n");
sb.append(" enumIntegerOnly: ").append(toIndentedString(enumIntegerOnly)).append("\n");
sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n");
sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n");
sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n");
@@ -542,6 +608,11 @@ public class EnumTest {
joiner.add(String.format("%senum_integer%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getEnumInteger()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `enum_integer_only` to the URL query string
if (getEnumIntegerOnly() != null) {
joiner.add(String.format("%senum_integer_only%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getEnumIntegerOnly()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `enum_number` to the URL query string
if (getEnumNumber() != null) {
joiner.add(String.format("%senum_number%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getEnumNumber()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));

View File

@@ -0,0 +1,186 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* EquilateralTriangle
*/
@JsonPropertyOrder({
EquilateralTriangle.JSON_PROPERTY_SHAPE_TYPE,
EquilateralTriangle.JSON_PROPERTY_TRIANGLE_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class EquilateralTriangle {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType";
private String triangleType;
public EquilateralTriangle() {
}
public EquilateralTriangle shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public EquilateralTriangle triangleType(String triangleType) {
this.triangleType = triangleType;
return this;
}
/**
* Get triangleType
* @return triangleType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getTriangleType() {
return triangleType;
}
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setTriangleType(String triangleType) {
this.triangleType = triangleType;
}
/**
* Return true if this EquilateralTriangle object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EquilateralTriangle equilateralTriangle = (EquilateralTriangle) o;
return Objects.equals(this.shapeType, equilateralTriangle.shapeType) &&
Objects.equals(this.triangleType, equilateralTriangle.triangleType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType, triangleType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class EquilateralTriangle {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n");
sb.append(" triangleType: ").append(toIndentedString(triangleType)).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 `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `triangleType` to the URL query string
if (getTriangleType() != null) {
joiner.add(String.format("%striangleType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getTriangleType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,297 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.openapitools.client.model.Apple;
import org.openapitools.client.model.Banana;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Fruit.FruitDeserializer.class)
@JsonSerialize(using = Fruit.FruitSerializer.class)
public class Fruit extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Fruit.class.getName());
public static class FruitSerializer extends StdSerializer<Fruit> {
public FruitSerializer(Class<Fruit> t) {
super(t);
}
public FruitSerializer() {
this(null);
}
@Override
public void serialize(Fruit value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class FruitDeserializer extends StdDeserializer<Fruit> {
public FruitDeserializer() {
this(Fruit.class);
}
public FruitDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Fruit deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize Apple
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Apple.class.equals(Integer.class) || Apple.class.equals(Long.class) || Apple.class.equals(Float.class) || Apple.class.equals(Double.class) || Apple.class.equals(Boolean.class) || Apple.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Apple.class.equals(Integer.class) || Apple.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Apple.class.equals(Float.class) || Apple.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Apple.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Apple.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Apple.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Apple'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Apple'", e);
}
// deserialize Banana
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Banana.class.equals(Integer.class) || Banana.class.equals(Long.class) || Banana.class.equals(Float.class) || Banana.class.equals(Double.class) || Banana.class.equals(Boolean.class) || Banana.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Banana.class.equals(Integer.class) || Banana.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Banana.class.equals(Float.class) || Banana.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Banana.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Banana.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Banana.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Banana'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Banana'", e);
}
if (match == 1) {
Fruit ret = new Fruit();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Fruit: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Fruit getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Fruit cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Fruit() {
super("oneOf", Boolean.FALSE);
}
public Fruit(Apple o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Fruit(Banana o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("Apple", Apple.class);
schemas.put("Banana", Banana.class);
JSON.registerDescendants(Fruit.class, Collections.unmodifiableMap(schemas));
}
@Override
public Map<String, Class<?>> getSchemas() {
return Fruit.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* Apple, Banana
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(Apple.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Banana.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Apple, Banana");
}
/**
* Get the actual instance, which can be the following:
* Apple, Banana
*
* @return The actual instance (Apple, Banana)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Apple`. If the actual instance is not `Apple`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Apple`
* @throws ClassCastException if the instance is not `Apple`
*/
public Apple getApple() throws ClassCastException {
return (Apple)super.getActualInstance();
}
/**
* Get the actual instance of `Banana`. If the actual instance is not `Banana`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Banana`
* @throws ClassCastException if the instance is not `Banana`
*/
public Banana getBanana() throws ClassCastException {
return (Banana)super.getActualInstance();
}
/**
* 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("&");
if (getActualInstance() instanceof Apple) {
if (getActualInstance() != null) {
joiner.add(((Apple)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof Banana) {
if (getActualInstance() != null) {
joiner.add(((Banana)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@@ -0,0 +1,297 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.openapitools.client.model.AppleReq;
import org.openapitools.client.model.BananaReq;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = FruitReq.FruitReqDeserializer.class)
@JsonSerialize(using = FruitReq.FruitReqSerializer.class)
public class FruitReq extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(FruitReq.class.getName());
public static class FruitReqSerializer extends StdSerializer<FruitReq> {
public FruitReqSerializer(Class<FruitReq> t) {
super(t);
}
public FruitReqSerializer() {
this(null);
}
@Override
public void serialize(FruitReq value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class FruitReqDeserializer extends StdDeserializer<FruitReq> {
public FruitReqDeserializer() {
this(FruitReq.class);
}
public FruitReqDeserializer(Class<?> vc) {
super(vc);
}
@Override
public FruitReq deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize AppleReq
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (AppleReq.class.equals(Integer.class) || AppleReq.class.equals(Long.class) || AppleReq.class.equals(Float.class) || AppleReq.class.equals(Double.class) || AppleReq.class.equals(Boolean.class) || AppleReq.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((AppleReq.class.equals(Integer.class) || AppleReq.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((AppleReq.class.equals(Float.class) || AppleReq.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (AppleReq.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (AppleReq.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(AppleReq.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'AppleReq'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'AppleReq'", e);
}
// deserialize BananaReq
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (BananaReq.class.equals(Integer.class) || BananaReq.class.equals(Long.class) || BananaReq.class.equals(Float.class) || BananaReq.class.equals(Double.class) || BananaReq.class.equals(Boolean.class) || BananaReq.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((BananaReq.class.equals(Integer.class) || BananaReq.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((BananaReq.class.equals(Float.class) || BananaReq.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (BananaReq.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (BananaReq.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(BananaReq.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'BananaReq'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'BananaReq'", e);
}
if (match == 1) {
FruitReq ret = new FruitReq();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for FruitReq: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public FruitReq getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "FruitReq cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public FruitReq() {
super("oneOf", Boolean.FALSE);
}
public FruitReq(AppleReq o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public FruitReq(BananaReq o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("AppleReq", AppleReq.class);
schemas.put("BananaReq", BananaReq.class);
JSON.registerDescendants(FruitReq.class, Collections.unmodifiableMap(schemas));
}
@Override
public Map<String, Class<?>> getSchemas() {
return FruitReq.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* AppleReq, BananaReq
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(AppleReq.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(BananaReq.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be AppleReq, BananaReq");
}
/**
* Get the actual instance, which can be the following:
* AppleReq, BananaReq
*
* @return The actual instance (AppleReq, BananaReq)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `AppleReq`. If the actual instance is not `AppleReq`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `AppleReq`
* @throws ClassCastException if the instance is not `AppleReq`
*/
public AppleReq getAppleReq() throws ClassCastException {
return (AppleReq)super.getActualInstance();
}
/**
* Get the actual instance of `BananaReq`. If the actual instance is not `BananaReq`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `BananaReq`
* @throws ClassCastException if the instance is not `BananaReq`
*/
public BananaReq getBananaReq() throws ClassCastException {
return (BananaReq)super.getActualInstance();
}
/**
* 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("&");
if (getActualInstance() instanceof AppleReq) {
if (getActualInstance() != null) {
joiner.add(((AppleReq)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof BananaReq) {
if (getActualInstance() != null) {
joiner.add(((BananaReq)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.openapitools.client.model.Apple;
import org.openapitools.client.model.Banana;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using=GmFruit.GmFruitDeserializer.class)
@JsonSerialize(using = GmFruit.GmFruitSerializer.class)
public class GmFruit extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(GmFruit.class.getName());
public static class GmFruitSerializer extends StdSerializer<GmFruit> {
public GmFruitSerializer(Class<GmFruit> t) {
super(t);
}
public GmFruitSerializer() {
this(null);
}
@Override
public void serialize(GmFruit value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class GmFruitDeserializer extends StdDeserializer<GmFruit> {
public GmFruitDeserializer() {
this(GmFruit.class);
}
public GmFruitDeserializer(Class<?> vc) {
super(vc);
}
@Override
public GmFruit deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
// deserialize Apple
try {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Apple.class);
GmFruit ret = new GmFruit();
ret.setActualInstance(deserialized);
return ret;
} catch (Exception e) {
// deserialization failed, continue, log to help debugging
log.log(Level.FINER, "Input data does not match 'GmFruit'", e);
}
// deserialize Banana
try {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Banana.class);
GmFruit ret = new GmFruit();
ret.setActualInstance(deserialized);
return ret;
} catch (Exception e) {
// deserialization failed, continue, log to help debugging
log.log(Level.FINER, "Input data does not match 'GmFruit'", e);
}
throw new IOException(String.format("Failed deserialization for GmFruit: no match found"));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public GmFruit getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "GmFruit cannot be null");
}
}
// store a list of schema names defined in anyOf
public static final Map<String, Class<?>> schemas = new HashMap<String, Class<?>>();
public GmFruit() {
super("anyOf", Boolean.FALSE);
}
public GmFruit(Apple o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}
public GmFruit(Banana o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("Apple", Apple.class);
schemas.put("Banana", Banana.class);
JSON.registerDescendants(GmFruit.class, Collections.unmodifiableMap(schemas));
}
@Override
public Map<String, Class<?>> getSchemas() {
return GmFruit.schemas;
}
/**
* Set the instance that matches the anyOf child schema, check
* the instance parameter is valid against the anyOf child schemas:
* Apple, Banana
*
* It could be an instance of the 'anyOf' schemas.
* The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(Apple.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Banana.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Apple, Banana");
}
/**
* Get the actual instance, which can be the following:
* Apple, Banana
*
* @return The actual instance (Apple, Banana)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Apple`. If the actual instance is not `Apple`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Apple`
* @throws ClassCastException if the instance is not `Apple`
*/
public Apple getApple() throws ClassCastException {
return (Apple)super.getActualInstance();
}
/**
* Get the actual instance of `Banana`. If the actual instance is not `Banana`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Banana`
* @throws ClassCastException if the instance is not `Banana`
*/
public Banana getBanana() throws ClassCastException {
return (Banana)super.getActualInstance();
}
}

View File

@@ -0,0 +1,174 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
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.ChildCat;
import org.openapitools.client.model.ParentPet;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.JSON;
/**
* GrandparentAnimal
*/
@JsonPropertyOrder({
GrandparentAnimal.JSON_PROPERTY_PET_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonIgnoreProperties(
value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the pet_type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = ChildCat.class, name = "ChildCat"),
@JsonSubTypes.Type(value = ParentPet.class, name = "ParentPet"),
})
public class GrandparentAnimal {
public static final String JSON_PROPERTY_PET_TYPE = "pet_type";
private String petType;
public GrandparentAnimal() {
}
public GrandparentAnimal petType(String petType) {
this.petType = petType;
return this;
}
/**
* Get petType
* @return petType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getPetType() {
return petType;
}
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setPetType(String petType) {
this.petType = petType;
}
/**
* Return true if this GrandparentAnimal object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GrandparentAnimal grandparentAnimal = (GrandparentAnimal) o;
return Objects.equals(this.petType, grandparentAnimal.petType);
}
@Override
public int hashCode() {
return Objects.hash(petType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class GrandparentAnimal {\n");
sb.append(" petType: ").append(toIndentedString(petType)).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 `pet_type` to the URL query string
if (getPetType() != null) {
joiner.add(String.format("%spet_type%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getPetType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
static {
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("ChildCat", ChildCat.class);
mappings.put("ParentPet", ParentPet.class);
mappings.put("GrandparentAnimal", GrandparentAnimal.class);
JSON.registerDiscriminator(GrandparentAnimal.class, "pet_type", mappings);
}
}

View File

@@ -0,0 +1,186 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* IsoscelesTriangle
*/
@JsonPropertyOrder({
IsoscelesTriangle.JSON_PROPERTY_SHAPE_TYPE,
IsoscelesTriangle.JSON_PROPERTY_TRIANGLE_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class IsoscelesTriangle {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType";
private String triangleType;
public IsoscelesTriangle() {
}
public IsoscelesTriangle shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public IsoscelesTriangle triangleType(String triangleType) {
this.triangleType = triangleType;
return this;
}
/**
* Get triangleType
* @return triangleType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getTriangleType() {
return triangleType;
}
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setTriangleType(String triangleType) {
this.triangleType = triangleType;
}
/**
* Return true if this IsoscelesTriangle object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
IsoscelesTriangle isoscelesTriangle = (IsoscelesTriangle) o;
return Objects.equals(this.shapeType, isoscelesTriangle.shapeType) &&
Objects.equals(this.triangleType, isoscelesTriangle.triangleType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType, triangleType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class IsoscelesTriangle {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n");
sb.append(" triangleType: ").append(toIndentedString(triangleType)).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 `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `triangleType` to the URL query string
if (getTriangleType() != null) {
joiner.add(String.format("%striangleType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getTriangleType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,361 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
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.Pig;
import org.openapitools.client.model.Whale;
import org.openapitools.client.model.Zebra;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Mammal.MammalDeserializer.class)
@JsonSerialize(using = Mammal.MammalSerializer.class)
public class Mammal extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Mammal.class.getName());
public static class MammalSerializer extends StdSerializer<Mammal> {
public MammalSerializer(Class<Mammal> t) {
super(t);
}
public MammalSerializer() {
this(null);
}
@Override
public void serialize(Mammal value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class MammalDeserializer extends StdDeserializer<Mammal> {
public MammalDeserializer() {
this(Mammal.class);
}
public MammalDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Mammal deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize Pig
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Pig.class.equals(Integer.class) || Pig.class.equals(Long.class) || Pig.class.equals(Float.class) || Pig.class.equals(Double.class) || Pig.class.equals(Boolean.class) || Pig.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Pig.class.equals(Integer.class) || Pig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Pig.class.equals(Float.class) || Pig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Pig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Pig.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Pig.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Pig'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Pig'", e);
}
// deserialize Whale
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Whale.class.equals(Integer.class) || Whale.class.equals(Long.class) || Whale.class.equals(Float.class) || Whale.class.equals(Double.class) || Whale.class.equals(Boolean.class) || Whale.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Whale.class.equals(Integer.class) || Whale.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Whale.class.equals(Float.class) || Whale.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Whale.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Whale.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Whale.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Whale'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Whale'", e);
}
// deserialize Zebra
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Zebra.class.equals(Integer.class) || Zebra.class.equals(Long.class) || Zebra.class.equals(Float.class) || Zebra.class.equals(Double.class) || Zebra.class.equals(Boolean.class) || Zebra.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Zebra.class.equals(Integer.class) || Zebra.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Zebra.class.equals(Float.class) || Zebra.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Zebra.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Zebra.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Zebra.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Zebra'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Zebra'", e);
}
if (match == 1) {
Mammal ret = new Mammal();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Mammal: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Mammal getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Mammal cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Mammal() {
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) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("Pig", Pig.class);
schemas.put("Whale", Whale.class);
schemas.put("Zebra", Zebra.class);
JSON.registerDescendants(Mammal.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("Pig", Pig.class);
mappings.put("whale", Whale.class);
mappings.put("zebra", Zebra.class);
mappings.put("mammal", Mammal.class);
JSON.registerDiscriminator(Mammal.class, "className", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return Mammal.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* Pig, Whale, Zebra
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(Pig.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Whale.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Zebra.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra");
}
/**
* Get the actual instance, which can be the following:
* Pig, Whale, Zebra
*
* @return The actual instance (Pig, Whale, Zebra)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Pig`. If the actual instance is not `Pig`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Pig`
* @throws ClassCastException if the instance is not `Pig`
*/
public Pig getPig() throws ClassCastException {
return (Pig)super.getActualInstance();
}
/**
* Get the actual instance of `Whale`. If the actual instance is not `Whale`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Whale`
* @throws ClassCastException if the instance is not `Whale`
*/
public Whale getWhale() throws ClassCastException {
return (Whale)super.getActualInstance();
}
/**
* Get the actual instance of `Zebra`. If the actual instance is not `Zebra`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Zebra`
* @throws ClassCastException if the instance is not `Zebra`
*/
public Zebra getZebra() throws ClassCastException {
return (Zebra)super.getActualInstance();
}
/**
* 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("&");
if (getActualInstance() instanceof Whale) {
if (getActualInstance() != null) {
joiner.add(((Whale)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof Zebra) {
if (getActualInstance() != null) {
joiner.add(String.format("%sone_of_1%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getActualInstance()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
if (getActualInstance() instanceof Pig) {
if (getActualInstance() != null) {
joiner.add(((Pig)getActualInstance()).toUrlQueryString(prefix + "one_of_2" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@@ -0,0 +1,312 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
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.Quadrilateral;
import org.openapitools.client.model.Triangle;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = NullableShape.NullableShapeDeserializer.class)
@JsonSerialize(using = NullableShape.NullableShapeSerializer.class)
public class NullableShape extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(NullableShape.class.getName());
public static class NullableShapeSerializer extends StdSerializer<NullableShape> {
public NullableShapeSerializer(Class<NullableShape> t) {
super(t);
}
public NullableShapeSerializer() {
this(null);
}
@Override
public void serialize(NullableShape value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class NullableShapeDeserializer extends StdDeserializer<NullableShape> {
public NullableShapeDeserializer() {
this(NullableShape.class);
}
public NullableShapeDeserializer(Class<?> vc) {
super(vc);
}
@Override
public NullableShape deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize Quadrilateral
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING);
attemptParsing |= (token == JsonToken.VALUE_NULL);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Quadrilateral'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e);
}
// deserialize Triangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
attemptParsing |= (token == JsonToken.VALUE_NULL);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Triangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Triangle'", e);
}
if (match == 1) {
NullableShape ret = new NullableShape();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for NullableShape: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public NullableShape getNullValue(DeserializationContext ctxt) throws JsonMappingException {
return null;
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public NullableShape() {
super("oneOf", Boolean.TRUE);
}
public NullableShape(Quadrilateral o) {
super("oneOf", Boolean.TRUE);
setActualInstance(o);
}
public NullableShape(Triangle o) {
super("oneOf", Boolean.TRUE);
setActualInstance(o);
}
static {
schemas.put("Quadrilateral", Quadrilateral.class);
schemas.put("Triangle", Triangle.class);
JSON.registerDescendants(NullableShape.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("Quadrilateral", Quadrilateral.class);
mappings.put("Triangle", Triangle.class);
mappings.put("NullableShape", NullableShape.class);
JSON.registerDiscriminator(NullableShape.class, "shapeType", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return NullableShape.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* Quadrilateral, Triangle
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (instance == null) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Triangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle");
}
/**
* Get the actual instance, which can be the following:
* Quadrilateral, Triangle
*
* @return The actual instance (Quadrilateral, Triangle)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Quadrilateral`
* @throws ClassCastException if the instance is not `Quadrilateral`
*/
public Quadrilateral getQuadrilateral() throws ClassCastException {
return (Quadrilateral)super.getActualInstance();
}
/**
* Get the actual instance of `Triangle`. If the actual instance is not `Triangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Triangle`
* @throws ClassCastException if the instance is not `Triangle`
*/
public Triangle getTriangle() throws ClassCastException {
return (Triangle)super.getActualInstance();
}
/**
* 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("&");
if (getActualInstance() instanceof Triangle) {
if (getActualInstance() != null) {
joiner.add(((Triangle)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof Quadrilateral) {
if (getActualInstance() != null) {
joiner.add(((Quadrilateral)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@@ -0,0 +1,142 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
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.ChildCat;
import org.openapitools.client.model.GrandparentAnimal;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.JSON;
/**
* ParentPet
*/
@JsonPropertyOrder({
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonIgnoreProperties(
value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the pet_type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = ChildCat.class, name = "ChildCat"),
})
public class ParentPet extends GrandparentAnimal {
public ParentPet() {
}
/**
* Return true if this ParentPet object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ParentPet {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* 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 `pet_type` to the URL query string
if (getPetType() != null) {
joiner.add(String.format("%spet_type%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getPetType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
static {
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("ChildCat", ChildCat.class);
mappings.put("ParentPet", ParentPet.class);
JSON.registerDiscriminator(ParentPet.class, "pet_type", mappings);
}
}

View File

@@ -25,11 +25,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.openapitools.client.model.Category;
import org.openapitools.client.model.Tag;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -58,7 +55,7 @@ public class Pet {
private String name;
public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls";
private Set<String> photoUrls = new LinkedHashSet<>();
private List<String> photoUrls = new ArrayList<>();
public static final String JSON_PROPERTY_TAGS = "tags";
private List<Tag> tags = null;
@@ -181,7 +178,7 @@ public class Pet {
}
public Pet photoUrls(Set<String> photoUrls) {
public Pet photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
@@ -199,15 +196,14 @@ public class Pet {
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public Set<String> getPhotoUrls() {
public List<String> getPhotoUrls() {
return photoUrls;
}
@JsonDeserialize(as = LinkedHashSet.class)
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setPhotoUrls(Set<String> photoUrls) {
public void setPhotoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
}
@@ -369,13 +365,11 @@ public class Pet {
// add `photoUrls` to the URL query string
if (getPhotoUrls() != null) {
int i = 0;
for (String _item : getPhotoUrls()) {
for (int i = 0; i < getPhotoUrls().size(); i++) {
joiner.add(String.format("%sphotoUrls%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
URLEncoder.encode(String.valueOf(getPhotoUrls().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
i++;
}
// add `tags` to the URL query string

View File

@@ -0,0 +1,305 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
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.BasquePig;
import org.openapitools.client.model.DanishPig;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Pig.PigDeserializer.class)
@JsonSerialize(using = Pig.PigSerializer.class)
public class Pig extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Pig.class.getName());
public static class PigSerializer extends StdSerializer<Pig> {
public PigSerializer(Class<Pig> t) {
super(t);
}
public PigSerializer() {
this(null);
}
@Override
public void serialize(Pig value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class PigDeserializer extends StdDeserializer<Pig> {
public PigDeserializer() {
this(Pig.class);
}
public PigDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Pig deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize BasquePig
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (BasquePig.class.equals(Integer.class) || BasquePig.class.equals(Long.class) || BasquePig.class.equals(Float.class) || BasquePig.class.equals(Double.class) || BasquePig.class.equals(Boolean.class) || BasquePig.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((BasquePig.class.equals(Integer.class) || BasquePig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((BasquePig.class.equals(Float.class) || BasquePig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (BasquePig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (BasquePig.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(BasquePig.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'BasquePig'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'BasquePig'", e);
}
// deserialize DanishPig
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (DanishPig.class.equals(Integer.class) || DanishPig.class.equals(Long.class) || DanishPig.class.equals(Float.class) || DanishPig.class.equals(Double.class) || DanishPig.class.equals(Boolean.class) || DanishPig.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((DanishPig.class.equals(Integer.class) || DanishPig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((DanishPig.class.equals(Float.class) || DanishPig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (DanishPig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (DanishPig.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(DanishPig.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'DanishPig'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'DanishPig'", e);
}
if (match == 1) {
Pig ret = new Pig();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Pig: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Pig getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Pig cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Pig() {
super("oneOf", Boolean.FALSE);
}
public Pig(BasquePig o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Pig(DanishPig o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("BasquePig", BasquePig.class);
schemas.put("DanishPig", DanishPig.class);
JSON.registerDescendants(Pig.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("BasquePig", BasquePig.class);
mappings.put("DanishPig", DanishPig.class);
mappings.put("Pig", Pig.class);
JSON.registerDiscriminator(Pig.class, "className", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return Pig.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* BasquePig, DanishPig
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(BasquePig.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(DanishPig.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be BasquePig, DanishPig");
}
/**
* Get the actual instance, which can be the following:
* BasquePig, DanishPig
*
* @return The actual instance (BasquePig, DanishPig)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `BasquePig`. If the actual instance is not `BasquePig`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `BasquePig`
* @throws ClassCastException if the instance is not `BasquePig`
*/
public BasquePig getBasquePig() throws ClassCastException {
return (BasquePig)super.getActualInstance();
}
/**
* Get the actual instance of `DanishPig`. If the actual instance is not `DanishPig`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `DanishPig`
* @throws ClassCastException if the instance is not `DanishPig`
*/
public DanishPig getDanishPig() throws ClassCastException {
return (DanishPig)super.getActualInstance();
}
/**
* 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("&");
if (getActualInstance() instanceof BasquePig) {
if (getActualInstance() != null) {
joiner.add(((BasquePig)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof DanishPig) {
if (getActualInstance() != null) {
joiner.add(((DanishPig)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@@ -0,0 +1,305 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
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.ComplexQuadrilateral;
import org.openapitools.client.model.SimpleQuadrilateral;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Quadrilateral.QuadrilateralDeserializer.class)
@JsonSerialize(using = Quadrilateral.QuadrilateralSerializer.class)
public class Quadrilateral extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Quadrilateral.class.getName());
public static class QuadrilateralSerializer extends StdSerializer<Quadrilateral> {
public QuadrilateralSerializer(Class<Quadrilateral> t) {
super(t);
}
public QuadrilateralSerializer() {
this(null);
}
@Override
public void serialize(Quadrilateral value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class QuadrilateralDeserializer extends StdDeserializer<Quadrilateral> {
public QuadrilateralDeserializer() {
this(Quadrilateral.class);
}
public QuadrilateralDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Quadrilateral deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize ComplexQuadrilateral
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (ComplexQuadrilateral.class.equals(Integer.class) || ComplexQuadrilateral.class.equals(Long.class) || ComplexQuadrilateral.class.equals(Float.class) || ComplexQuadrilateral.class.equals(Double.class) || ComplexQuadrilateral.class.equals(Boolean.class) || ComplexQuadrilateral.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((ComplexQuadrilateral.class.equals(Integer.class) || ComplexQuadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((ComplexQuadrilateral.class.equals(Float.class) || ComplexQuadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (ComplexQuadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (ComplexQuadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(ComplexQuadrilateral.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'ComplexQuadrilateral'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'ComplexQuadrilateral'", e);
}
// deserialize SimpleQuadrilateral
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (SimpleQuadrilateral.class.equals(Integer.class) || SimpleQuadrilateral.class.equals(Long.class) || SimpleQuadrilateral.class.equals(Float.class) || SimpleQuadrilateral.class.equals(Double.class) || SimpleQuadrilateral.class.equals(Boolean.class) || SimpleQuadrilateral.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((SimpleQuadrilateral.class.equals(Integer.class) || SimpleQuadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((SimpleQuadrilateral.class.equals(Float.class) || SimpleQuadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (SimpleQuadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (SimpleQuadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(SimpleQuadrilateral.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'SimpleQuadrilateral'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'SimpleQuadrilateral'", e);
}
if (match == 1) {
Quadrilateral ret = new Quadrilateral();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Quadrilateral: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Quadrilateral getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Quadrilateral cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Quadrilateral() {
super("oneOf", Boolean.FALSE);
}
public Quadrilateral(ComplexQuadrilateral o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Quadrilateral(SimpleQuadrilateral o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("ComplexQuadrilateral", ComplexQuadrilateral.class);
schemas.put("SimpleQuadrilateral", SimpleQuadrilateral.class);
JSON.registerDescendants(Quadrilateral.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("ComplexQuadrilateral", ComplexQuadrilateral.class);
mappings.put("SimpleQuadrilateral", SimpleQuadrilateral.class);
mappings.put("Quadrilateral", Quadrilateral.class);
JSON.registerDiscriminator(Quadrilateral.class, "quadrilateralType", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return Quadrilateral.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* ComplexQuadrilateral, SimpleQuadrilateral
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(ComplexQuadrilateral.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(SimpleQuadrilateral.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be ComplexQuadrilateral, SimpleQuadrilateral");
}
/**
* Get the actual instance, which can be the following:
* ComplexQuadrilateral, SimpleQuadrilateral
*
* @return The actual instance (ComplexQuadrilateral, SimpleQuadrilateral)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `ComplexQuadrilateral`. If the actual instance is not `ComplexQuadrilateral`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `ComplexQuadrilateral`
* @throws ClassCastException if the instance is not `ComplexQuadrilateral`
*/
public ComplexQuadrilateral getComplexQuadrilateral() throws ClassCastException {
return (ComplexQuadrilateral)super.getActualInstance();
}
/**
* Get the actual instance of `SimpleQuadrilateral`. If the actual instance is not `SimpleQuadrilateral`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `SimpleQuadrilateral`
* @throws ClassCastException if the instance is not `SimpleQuadrilateral`
*/
public SimpleQuadrilateral getSimpleQuadrilateral() throws ClassCastException {
return (SimpleQuadrilateral)super.getActualInstance();
}
/**
* 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("&");
if (getActualInstance() instanceof SimpleQuadrilateral) {
if (getActualInstance() != null) {
joiner.add(((SimpleQuadrilateral)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof ComplexQuadrilateral) {
if (getActualInstance() != null) {
joiner.add(((ComplexQuadrilateral)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* QuadrilateralInterface
*/
@JsonPropertyOrder({
QuadrilateralInterface.JSON_PROPERTY_QUADRILATERAL_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class QuadrilateralInterface {
public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType";
private String quadrilateralType;
public QuadrilateralInterface() {
}
public QuadrilateralInterface quadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
return this;
}
/**
* Get quadrilateralType
* @return quadrilateralType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getQuadrilateralType() {
return quadrilateralType;
}
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setQuadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
}
/**
* Return true if this QuadrilateralInterface object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
QuadrilateralInterface quadrilateralInterface = (QuadrilateralInterface) o;
return Objects.equals(this.quadrilateralType, quadrilateralInterface.quadrilateralType);
}
@Override
public int hashCode() {
return Objects.hash(quadrilateralType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class QuadrilateralInterface {\n");
sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).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 `quadrilateralType` to the URL query string
if (getQuadrilateralType() != null) {
joiner.add(String.format("%squadrilateralType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getQuadrilateralType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,186 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* ScaleneTriangle
*/
@JsonPropertyOrder({
ScaleneTriangle.JSON_PROPERTY_SHAPE_TYPE,
ScaleneTriangle.JSON_PROPERTY_TRIANGLE_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ScaleneTriangle {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType";
private String triangleType;
public ScaleneTriangle() {
}
public ScaleneTriangle shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public ScaleneTriangle triangleType(String triangleType) {
this.triangleType = triangleType;
return this;
}
/**
* Get triangleType
* @return triangleType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getTriangleType() {
return triangleType;
}
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setTriangleType(String triangleType) {
this.triangleType = triangleType;
}
/**
* Return true if this ScaleneTriangle object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ScaleneTriangle scaleneTriangle = (ScaleneTriangle) o;
return Objects.equals(this.shapeType, scaleneTriangle.shapeType) &&
Objects.equals(this.triangleType, scaleneTriangle.triangleType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType, triangleType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ScaleneTriangle {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n");
sb.append(" triangleType: ").append(toIndentedString(triangleType)).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 `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `triangleType` to the URL query string
if (getTriangleType() != null) {
joiner.add(String.format("%striangleType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getTriangleType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,305 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
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.Quadrilateral;
import org.openapitools.client.model.Triangle;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Shape.ShapeDeserializer.class)
@JsonSerialize(using = Shape.ShapeSerializer.class)
public class Shape extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Shape.class.getName());
public static class ShapeSerializer extends StdSerializer<Shape> {
public ShapeSerializer(Class<Shape> t) {
super(t);
}
public ShapeSerializer() {
this(null);
}
@Override
public void serialize(Shape value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class ShapeDeserializer extends StdDeserializer<Shape> {
public ShapeDeserializer() {
this(Shape.class);
}
public ShapeDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Shape deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize Quadrilateral
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Quadrilateral'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e);
}
// deserialize Triangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Triangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Triangle'", e);
}
if (match == 1) {
Shape ret = new Shape();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Shape: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Shape getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Shape cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Shape() {
super("oneOf", Boolean.FALSE);
}
public Shape(Quadrilateral o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Shape(Triangle o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("Quadrilateral", Quadrilateral.class);
schemas.put("Triangle", Triangle.class);
JSON.registerDescendants(Shape.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("Quadrilateral", Quadrilateral.class);
mappings.put("Triangle", Triangle.class);
mappings.put("Shape", Shape.class);
JSON.registerDiscriminator(Shape.class, "shapeType", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return Shape.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* Quadrilateral, Triangle
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Triangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle");
}
/**
* Get the actual instance, which can be the following:
* Quadrilateral, Triangle
*
* @return The actual instance (Quadrilateral, Triangle)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Quadrilateral`
* @throws ClassCastException if the instance is not `Quadrilateral`
*/
public Quadrilateral getQuadrilateral() throws ClassCastException {
return (Quadrilateral)super.getActualInstance();
}
/**
* Get the actual instance of `Triangle`. If the actual instance is not `Triangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Triangle`
* @throws ClassCastException if the instance is not `Triangle`
*/
public Triangle getTriangle() throws ClassCastException {
return (Triangle)super.getActualInstance();
}
/**
* 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("&");
if (getActualInstance() instanceof Triangle) {
if (getActualInstance() != null) {
joiner.add(((Triangle)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof Quadrilateral) {
if (getActualInstance() != null) {
joiner.add(((Quadrilateral)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* ShapeInterface
*/
@JsonPropertyOrder({
ShapeInterface.JSON_PROPERTY_SHAPE_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ShapeInterface {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public ShapeInterface() {
}
public ShapeInterface shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
/**
* Return true if this ShapeInterface object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ShapeInterface shapeInterface = (ShapeInterface) o;
return Objects.equals(this.shapeType, shapeInterface.shapeType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ShapeInterface {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).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 `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,305 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
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.Quadrilateral;
import org.openapitools.client.model.Triangle;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = ShapeOrNull.ShapeOrNullDeserializer.class)
@JsonSerialize(using = ShapeOrNull.ShapeOrNullSerializer.class)
public class ShapeOrNull extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(ShapeOrNull.class.getName());
public static class ShapeOrNullSerializer extends StdSerializer<ShapeOrNull> {
public ShapeOrNullSerializer(Class<ShapeOrNull> t) {
super(t);
}
public ShapeOrNullSerializer() {
this(null);
}
@Override
public void serialize(ShapeOrNull value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class ShapeOrNullDeserializer extends StdDeserializer<ShapeOrNull> {
public ShapeOrNullDeserializer() {
this(ShapeOrNull.class);
}
public ShapeOrNullDeserializer(Class<?> vc) {
super(vc);
}
@Override
public ShapeOrNull deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize Quadrilateral
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Quadrilateral'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e);
}
// deserialize Triangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Triangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Triangle'", e);
}
if (match == 1) {
ShapeOrNull ret = new ShapeOrNull();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for ShapeOrNull: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public ShapeOrNull getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "ShapeOrNull cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public ShapeOrNull() {
super("oneOf", Boolean.FALSE);
}
public ShapeOrNull(Quadrilateral o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public ShapeOrNull(Triangle o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("Quadrilateral", Quadrilateral.class);
schemas.put("Triangle", Triangle.class);
JSON.registerDescendants(ShapeOrNull.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("Quadrilateral", Quadrilateral.class);
mappings.put("Triangle", Triangle.class);
mappings.put("ShapeOrNull", ShapeOrNull.class);
JSON.registerDiscriminator(ShapeOrNull.class, "shapeType", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return ShapeOrNull.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* Quadrilateral, Triangle
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Triangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle");
}
/**
* Get the actual instance, which can be the following:
* Quadrilateral, Triangle
*
* @return The actual instance (Quadrilateral, Triangle)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Quadrilateral`
* @throws ClassCastException if the instance is not `Quadrilateral`
*/
public Quadrilateral getQuadrilateral() throws ClassCastException {
return (Quadrilateral)super.getActualInstance();
}
/**
* Get the actual instance of `Triangle`. If the actual instance is not `Triangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Triangle`
* @throws ClassCastException if the instance is not `Triangle`
*/
public Triangle getTriangle() throws ClassCastException {
return (Triangle)super.getActualInstance();
}
/**
* 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("&");
if (getActualInstance() instanceof Triangle) {
if (getActualInstance() != null) {
joiner.add(((Triangle)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof Quadrilateral) {
if (getActualInstance() != null) {
joiner.add(((Quadrilateral)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@@ -0,0 +1,186 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* SimpleQuadrilateral
*/
@JsonPropertyOrder({
SimpleQuadrilateral.JSON_PROPERTY_SHAPE_TYPE,
SimpleQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class SimpleQuadrilateral {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType";
private String quadrilateralType;
public SimpleQuadrilateral() {
}
public SimpleQuadrilateral shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public SimpleQuadrilateral quadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
return this;
}
/**
* Get quadrilateralType
* @return quadrilateralType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getQuadrilateralType() {
return quadrilateralType;
}
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setQuadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
}
/**
* Return true if this SimpleQuadrilateral object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SimpleQuadrilateral simpleQuadrilateral = (SimpleQuadrilateral) o;
return Objects.equals(this.shapeType, simpleQuadrilateral.shapeType) &&
Objects.equals(this.quadrilateralType, simpleQuadrilateral.quadrilateralType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType, quadrilateralType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SimpleQuadrilateral {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n");
sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).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 `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `quadrilateralType` to the URL query string
if (getQuadrilateralType() != null) {
joiner.add(String.format("%squadrilateralType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getQuadrilateralType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -32,13 +32,17 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
* SpecialModelName
*/
@JsonPropertyOrder({
SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME
SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME,
SpecialModelName.JSON_PROPERTY_SPECIAL_MODEL_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class SpecialModelName {
public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]";
private Long $specialPropertyName;
public static final String JSON_PROPERTY_SPECIAL_MODEL_NAME = "_special_model.name_";
private String specialModelName;
public SpecialModelName() {
}
@@ -67,6 +71,31 @@ public class SpecialModelName {
}
public SpecialModelName specialModelName(String specialModelName) {
this.specialModelName = specialModelName;
return this;
}
/**
* Get specialModelName
* @return specialModelName
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SPECIAL_MODEL_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getSpecialModelName() {
return specialModelName;
}
@JsonProperty(JSON_PROPERTY_SPECIAL_MODEL_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSpecialModelName(String specialModelName) {
this.specialModelName = specialModelName;
}
/**
* Return true if this _special_model.name_ object is equal to o.
*/
@@ -79,12 +108,13 @@ public class SpecialModelName {
return false;
}
SpecialModelName specialModelName = (SpecialModelName) o;
return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName);
return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName) &&
Objects.equals(this.specialModelName, specialModelName.specialModelName);
}
@Override
public int hashCode() {
return Objects.hash($specialPropertyName);
return Objects.hash($specialPropertyName, specialModelName);
}
@Override
@@ -92,6 +122,7 @@ public class SpecialModelName {
StringBuilder sb = new StringBuilder();
sb.append("class SpecialModelName {\n");
sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n");
sb.append(" specialModelName: ").append(toIndentedString(specialModelName)).append("\n");
sb.append("}");
return sb.toString();
}
@@ -144,6 +175,11 @@ public class SpecialModelName {
joiner.add(String.format("%s$special[property.name]%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(get$SpecialPropertyName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `_special_model.name_` to the URL query string
if (getSpecialModelName() != null) {
joiner.add(String.format("%s_special_model.name_%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSpecialModelName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,361 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
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.EquilateralTriangle;
import org.openapitools.client.model.IsoscelesTriangle;
import org.openapitools.client.model.ScaleneTriangle;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Triangle.TriangleDeserializer.class)
@JsonSerialize(using = Triangle.TriangleSerializer.class)
public class Triangle extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Triangle.class.getName());
public static class TriangleSerializer extends StdSerializer<Triangle> {
public TriangleSerializer(Class<Triangle> t) {
super(t);
}
public TriangleSerializer() {
this(null);
}
@Override
public void serialize(Triangle value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class TriangleDeserializer extends StdDeserializer<Triangle> {
public TriangleDeserializer() {
this(Triangle.class);
}
public TriangleDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Triangle deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize EquilateralTriangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (EquilateralTriangle.class.equals(Integer.class) || EquilateralTriangle.class.equals(Long.class) || EquilateralTriangle.class.equals(Float.class) || EquilateralTriangle.class.equals(Double.class) || EquilateralTriangle.class.equals(Boolean.class) || EquilateralTriangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((EquilateralTriangle.class.equals(Integer.class) || EquilateralTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((EquilateralTriangle.class.equals(Float.class) || EquilateralTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (EquilateralTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (EquilateralTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(EquilateralTriangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'EquilateralTriangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'EquilateralTriangle'", e);
}
// deserialize IsoscelesTriangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (IsoscelesTriangle.class.equals(Integer.class) || IsoscelesTriangle.class.equals(Long.class) || IsoscelesTriangle.class.equals(Float.class) || IsoscelesTriangle.class.equals(Double.class) || IsoscelesTriangle.class.equals(Boolean.class) || IsoscelesTriangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((IsoscelesTriangle.class.equals(Integer.class) || IsoscelesTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((IsoscelesTriangle.class.equals(Float.class) || IsoscelesTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (IsoscelesTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (IsoscelesTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(IsoscelesTriangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'IsoscelesTriangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'IsoscelesTriangle'", e);
}
// deserialize ScaleneTriangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (ScaleneTriangle.class.equals(Integer.class) || ScaleneTriangle.class.equals(Long.class) || ScaleneTriangle.class.equals(Float.class) || ScaleneTriangle.class.equals(Double.class) || ScaleneTriangle.class.equals(Boolean.class) || ScaleneTriangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((ScaleneTriangle.class.equals(Integer.class) || ScaleneTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((ScaleneTriangle.class.equals(Float.class) || ScaleneTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (ScaleneTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (ScaleneTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(ScaleneTriangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'ScaleneTriangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'ScaleneTriangle'", e);
}
if (match == 1) {
Triangle ret = new Triangle();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Triangle: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Triangle getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Triangle cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Triangle() {
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) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("EquilateralTriangle", EquilateralTriangle.class);
schemas.put("IsoscelesTriangle", IsoscelesTriangle.class);
schemas.put("ScaleneTriangle", ScaleneTriangle.class);
JSON.registerDescendants(Triangle.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("EquilateralTriangle", EquilateralTriangle.class);
mappings.put("IsoscelesTriangle", IsoscelesTriangle.class);
mappings.put("ScaleneTriangle", ScaleneTriangle.class);
mappings.put("Triangle", Triangle.class);
JSON.registerDiscriminator(Triangle.class, "triangleType", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return Triangle.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(EquilateralTriangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(IsoscelesTriangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(ScaleneTriangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle");
}
/**
* Get the actual instance, which can be the following:
* EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle
*
* @return The actual instance (EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `EquilateralTriangle`. If the actual instance is not `EquilateralTriangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `EquilateralTriangle`
* @throws ClassCastException if the instance is not `EquilateralTriangle`
*/
public EquilateralTriangle getEquilateralTriangle() throws ClassCastException {
return (EquilateralTriangle)super.getActualInstance();
}
/**
* Get the actual instance of `IsoscelesTriangle`. If the actual instance is not `IsoscelesTriangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `IsoscelesTriangle`
* @throws ClassCastException if the instance is not `IsoscelesTriangle`
*/
public IsoscelesTriangle getIsoscelesTriangle() throws ClassCastException {
return (IsoscelesTriangle)super.getActualInstance();
}
/**
* Get the actual instance of `ScaleneTriangle`. If the actual instance is not `ScaleneTriangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `ScaleneTriangle`
* @throws ClassCastException if the instance is not `ScaleneTriangle`
*/
public ScaleneTriangle getScaleneTriangle() throws ClassCastException {
return (ScaleneTriangle)super.getActualInstance();
}
/**
* 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("&");
if (getActualInstance() instanceof EquilateralTriangle) {
if (getActualInstance() != null) {
joiner.add(((EquilateralTriangle)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof IsoscelesTriangle) {
if (getActualInstance() != null) {
joiner.add(((IsoscelesTriangle)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof ScaleneTriangle) {
if (getActualInstance() != null) {
joiner.add(((ScaleneTriangle)getActualInstance()).toUrlQueryString(prefix + "one_of_2" + suffix));
}
return joiner.toString();
}
return null;
}
}

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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* TriangleInterface
*/
@JsonPropertyOrder({
TriangleInterface.JSON_PROPERTY_TRIANGLE_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class TriangleInterface {
public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType";
private String triangleType;
public TriangleInterface() {
}
public TriangleInterface triangleType(String triangleType) {
this.triangleType = triangleType;
return this;
}
/**
* Get triangleType
* @return triangleType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getTriangleType() {
return triangleType;
}
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setTriangleType(String triangleType) {
this.triangleType = triangleType;
}
/**
* Return true if this TriangleInterface object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TriangleInterface triangleInterface = (TriangleInterface) o;
return Objects.equals(this.triangleType, triangleInterface.triangleType);
}
@Override
public int hashCode() {
return Objects.hash(triangleType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TriangleInterface {\n");
sb.append(" triangleType: ").append(toIndentedString(triangleType)).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 `triangleType` to the URL query string
if (getTriangleType() != null) {
joiner.add(String.format("%striangleType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getTriangleType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -25,6 +25,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
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;
@@ -39,7 +43,11 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
User.JSON_PROPERTY_EMAIL,
User.JSON_PROPERTY_PASSWORD,
User.JSON_PROPERTY_PHONE,
User.JSON_PROPERTY_USER_STATUS
User.JSON_PROPERTY_USER_STATUS,
User.JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS,
User.JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE,
User.JSON_PROPERTY_ANY_TYPE_PROP,
User.JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class User {
@@ -67,6 +75,18 @@ public class User {
public static final String JSON_PROPERTY_USER_STATUS = "userStatus";
private Integer userStatus;
public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS = "objectWithNoDeclaredProps";
private Object objectWithNoDeclaredProps;
public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE = "objectWithNoDeclaredPropsNullable";
private JsonNullable<Object> objectWithNoDeclaredPropsNullable = JsonNullable.<Object>undefined();
public static final String JSON_PROPERTY_ANY_TYPE_PROP = "anyTypeProp";
private JsonNullable<Object> anyTypeProp = JsonNullable.<Object>of(null);
public static final String JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE = "anyTypePropNullable";
private JsonNullable<Object> anyTypePropNullable = JsonNullable.<Object>of(null);
public User() {
}
@@ -270,6 +290,130 @@ public class User {
}
public User objectWithNoDeclaredProps(Object objectWithNoDeclaredProps) {
this.objectWithNoDeclaredProps = objectWithNoDeclaredProps;
return this;
}
/**
* test code generation for objects Value must be a map of strings to values. It cannot be the &#39;null&#39; value.
* @return objectWithNoDeclaredProps
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Object getObjectWithNoDeclaredProps() {
return objectWithNoDeclaredProps;
}
@JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setObjectWithNoDeclaredProps(Object objectWithNoDeclaredProps) {
this.objectWithNoDeclaredProps = objectWithNoDeclaredProps;
}
public User objectWithNoDeclaredPropsNullable(Object objectWithNoDeclaredPropsNullable) {
this.objectWithNoDeclaredPropsNullable = JsonNullable.<Object>of(objectWithNoDeclaredPropsNullable);
return this;
}
/**
* test code generation for nullable objects. Value must be a map of strings to values or the &#39;null&#39; value.
* @return objectWithNoDeclaredPropsNullable
**/
@javax.annotation.Nullable
@JsonIgnore
public Object getObjectWithNoDeclaredPropsNullable() {
return objectWithNoDeclaredPropsNullable.orElse(null);
}
@JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Object> getObjectWithNoDeclaredPropsNullable_JsonNullable() {
return objectWithNoDeclaredPropsNullable;
}
@JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE)
public void setObjectWithNoDeclaredPropsNullable_JsonNullable(JsonNullable<Object> objectWithNoDeclaredPropsNullable) {
this.objectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable;
}
public void setObjectWithNoDeclaredPropsNullable(Object objectWithNoDeclaredPropsNullable) {
this.objectWithNoDeclaredPropsNullable = JsonNullable.<Object>of(objectWithNoDeclaredPropsNullable);
}
public User anyTypeProp(Object anyTypeProp) {
this.anyTypeProp = JsonNullable.<Object>of(anyTypeProp);
return this;
}
/**
* test code generation for any type Here the &#39;type&#39; attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389
* @return anyTypeProp
**/
@javax.annotation.Nullable
@JsonIgnore
public Object getAnyTypeProp() {
return anyTypeProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Object> getAnyTypeProp_JsonNullable() {
return anyTypeProp;
}
@JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP)
public void setAnyTypeProp_JsonNullable(JsonNullable<Object> anyTypeProp) {
this.anyTypeProp = anyTypeProp;
}
public void setAnyTypeProp(Object anyTypeProp) {
this.anyTypeProp = JsonNullable.<Object>of(anyTypeProp);
}
public User anyTypePropNullable(Object anyTypePropNullable) {
this.anyTypePropNullable = JsonNullable.<Object>of(anyTypePropNullable);
return this;
}
/**
* test code generation for any type Here the &#39;type&#39; attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The &#39;nullable&#39; attribute does not change the allowed values.
* @return anyTypePropNullable
**/
@javax.annotation.Nullable
@JsonIgnore
public Object getAnyTypePropNullable() {
return anyTypePropNullable.orElse(null);
}
@JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Object> getAnyTypePropNullable_JsonNullable() {
return anyTypePropNullable;
}
@JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE)
public void setAnyTypePropNullable_JsonNullable(JsonNullable<Object> anyTypePropNullable) {
this.anyTypePropNullable = anyTypePropNullable;
}
public void setAnyTypePropNullable(Object anyTypePropNullable) {
this.anyTypePropNullable = JsonNullable.<Object>of(anyTypePropNullable);
}
/**
* Return true if this User object is equal to o.
*/
@@ -289,12 +433,27 @@ public class User {
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
Objects.equals(this.userStatus, user.userStatus) &&
Objects.equals(this.objectWithNoDeclaredProps, user.objectWithNoDeclaredProps) &&
equalsNullable(this.objectWithNoDeclaredPropsNullable, user.objectWithNoDeclaredPropsNullable) &&
equalsNullable(this.anyTypeProp, user.anyTypeProp) &&
equalsNullable(this.anyTypePropNullable, user.anyTypePropNullable);
}
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(id, username, firstName, lastName, email, password, phone, userStatus);
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, objectWithNoDeclaredProps, hashCodeNullable(objectWithNoDeclaredPropsNullable), hashCodeNullable(anyTypeProp), hashCodeNullable(anyTypePropNullable));
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
@@ -309,6 +468,10 @@ public class User {
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
sb.append(" objectWithNoDeclaredProps: ").append(toIndentedString(objectWithNoDeclaredProps)).append("\n");
sb.append(" objectWithNoDeclaredPropsNullable: ").append(toIndentedString(objectWithNoDeclaredPropsNullable)).append("\n");
sb.append(" anyTypeProp: ").append(toIndentedString(anyTypeProp)).append("\n");
sb.append(" anyTypePropNullable: ").append(toIndentedString(anyTypePropNullable)).append("\n");
sb.append("}");
return sb.toString();
}
@@ -396,6 +559,26 @@ public class User {
joiner.add(String.format("%suserStatus%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getUserStatus()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `objectWithNoDeclaredProps` to the URL query string
if (getObjectWithNoDeclaredProps() != null) {
joiner.add(String.format("%sobjectWithNoDeclaredProps%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getObjectWithNoDeclaredProps()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `objectWithNoDeclaredPropsNullable` to the URL query string
if (getObjectWithNoDeclaredPropsNullable() != null) {
joiner.add(String.format("%sobjectWithNoDeclaredPropsNullable%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getObjectWithNoDeclaredPropsNullable()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `anyTypeProp` to the URL query string
if (getAnyTypeProp() != null) {
joiner.add(String.format("%sanyTypeProp%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getAnyTypeProp()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `anyTypePropNullable` to the URL query string
if (getAnyTypePropNullable() != null) {
joiner.add(String.format("%sanyTypePropNullable%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getAnyTypePropNullable()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,222 @@
/*
* 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.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Whale
*/
@JsonPropertyOrder({
Whale.JSON_PROPERTY_HAS_BALEEN,
Whale.JSON_PROPERTY_HAS_TEETH,
Whale.JSON_PROPERTY_CLASS_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Whale {
public static final String JSON_PROPERTY_HAS_BALEEN = "hasBaleen";
private Boolean hasBaleen;
public static final String JSON_PROPERTY_HAS_TEETH = "hasTeeth";
private Boolean hasTeeth;
public static final String JSON_PROPERTY_CLASS_NAME = "className";
private String className;
public Whale() {
}
public Whale hasBaleen(Boolean hasBaleen) {
this.hasBaleen = hasBaleen;
return this;
}
/**
* Get hasBaleen
* @return hasBaleen
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_HAS_BALEEN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getHasBaleen() {
return hasBaleen;
}
@JsonProperty(JSON_PROPERTY_HAS_BALEEN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setHasBaleen(Boolean hasBaleen) {
this.hasBaleen = hasBaleen;
}
public Whale hasTeeth(Boolean hasTeeth) {
this.hasTeeth = hasTeeth;
return this;
}
/**
* Get hasTeeth
* @return hasTeeth
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_HAS_TEETH)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getHasTeeth() {
return hasTeeth;
}
@JsonProperty(JSON_PROPERTY_HAS_TEETH)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setHasTeeth(Boolean hasTeeth) {
this.hasTeeth = hasTeeth;
}
public Whale className(String className) {
this.className = className;
return this;
}
/**
* Get className
* @return className
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getClassName() {
return className;
}
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setClassName(String className) {
this.className = className;
}
/**
* Return true if this whale object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Whale whale = (Whale) o;
return Objects.equals(this.hasBaleen, whale.hasBaleen) &&
Objects.equals(this.hasTeeth, whale.hasTeeth) &&
Objects.equals(this.className, whale.className);
}
@Override
public int hashCode() {
return Objects.hash(hasBaleen, hasTeeth, className);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Whale {\n");
sb.append(" hasBaleen: ").append(toIndentedString(hasBaleen)).append("\n");
sb.append(" hasTeeth: ").append(toIndentedString(hasTeeth)).append("\n");
sb.append(" className: ").append(toIndentedString(className)).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 `hasBaleen` to the URL query string
if (getHasBaleen() != null) {
joiner.add(String.format("%shasBaleen%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getHasBaleen()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `hasTeeth` to the URL query string
if (getHasTeeth() != null) {
joiner.add(String.format("%shasTeeth%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getHasTeeth()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `className` to the URL query string
if (getClassName() != null) {
joiner.add(String.format("%sclassName%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClassName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,276 @@
/*
* 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.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Zebra
*/
@JsonPropertyOrder({
Zebra.JSON_PROPERTY_TYPE,
Zebra.JSON_PROPERTY_CLASS_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Zebra extends HashMap<String, Object> {
/**
* Gets or Sets type
*/
public enum TypeEnum {
PLAINS("plains"),
MOUNTAIN("mountain"),
GREVYS("grevys");
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";
private TypeEnum type;
public static final String JSON_PROPERTY_CLASS_NAME = "className";
private String className;
public Zebra() {
}
public Zebra 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 Zebra className(String className) {
this.className = className;
return this;
}
/**
* Get className
* @return className
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getClassName() {
return className;
}
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setClassName(String className) {
this.className = className;
}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
* @param key the name of the property
* @param value the value of the property
* @return self reference
*/
@JsonAnySetter
public Zebra putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) properties.
* @return the additional (undeclared) properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
* @param key the name of the property
* @return the additional (undeclared) property with the specified name
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
/**
* Return true if this zebra object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Zebra zebra = (Zebra) o;
return Objects.equals(this.type, zebra.type) &&
Objects.equals(this.className, zebra.className)&&
Objects.equals(this.additionalProperties, zebra.additionalProperties) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(type, className, super.hashCode(), additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Zebra {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" className: ").append(toIndentedString(className)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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) {
joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `className` to the URL query string
if (getClassName() != null) {
joiner.add(String.format("%sclassName%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClassName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@@ -16,15 +16,13 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiException;
import java.math.BigDecimal;
import org.openapitools.client.model.Client;
import org.openapitools.client.model.EnumClass;
import java.io.File;
import org.openapitools.client.model.FileSchemaTestClass;
import org.openapitools.client.model.HealthCheckResult;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.OuterObjectWithEnumProperty;
import org.openapitools.client.model.Pet;
import org.openapitools.client.model.OuterEnum;
import org.openapitools.client.model.User;
import org.junit.Test;
import org.junit.Ignore;
@@ -62,25 +60,6 @@ public class FakeApiTest {
// TODO: test validations
}
/**
* test http signature authentication
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void fakeHttpSignatureTestTest() throws ApiException {
Pet pet = null;
String query1 = null;
String header1 = null;
CompletableFuture<Void> response = api.fakeHttpSignatureTest(pet, query1, header1);
// TODO: test validations
}
/**
*
*
@@ -150,18 +129,17 @@ public class FakeApiTest {
}
/**
*
* Array of Enums
*
* Test serialization of enum (int) properties with examples
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void fakePropertyEnumIntegerSerializeTest() throws ApiException {
OuterObjectWithEnumProperty outerObjectWithEnumProperty = null;
CompletableFuture<OuterObjectWithEnumProperty> response =
api.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty);
public void getArrayOfEnumsTest() throws ApiException {
CompletableFuture<List<OuterEnum>> response =
api.getArrayOfEnums();
// TODO: test validations
}
@@ -169,24 +147,7 @@ public class FakeApiTest {
/**
*
*
* For this test, the body has to be a binary file.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testBodyWithBinaryTest() throws ApiException {
File body = null;
CompletableFuture<Void> response = api.testBodyWithBinary(body);
// TODO: test validations
}
/**
*
*
* For this test, the body for this request must reference a schema named &#x60;File&#x60;.
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
*
* @throws ApiException
* if the Api call fails
@@ -281,11 +242,10 @@ public class FakeApiTest {
String enumQueryString = null;
Integer enumQueryInteger = null;
Double enumQueryDouble = null;
List<EnumClass> enumQueryModelArray = null;
List<String> enumFormStringArray = null;
String enumFormString = null;
CompletableFuture<Void> response = api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString);
CompletableFuture<Void> response = api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
// TODO: test validations
}
@@ -371,10 +331,8 @@ public class FakeApiTest {
List<String> http = null;
List<String> url = null;
List<String> context = null;
String allowEmpty = null;
Map<String, String> language = null;
CompletableFuture<Void> response = api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language);
CompletableFuture<Void> response = api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
// TODO: test validations
}

View File

@@ -17,7 +17,6 @@ import org.openapitools.client.ApiException;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import java.util.Set;
import org.junit.Test;
import org.junit.Ignore;
@@ -100,8 +99,8 @@ public class PetApiTest {
*/
@Test
public void findPetsByTagsTest() throws ApiException {
Set<String> tags = null;
CompletableFuture<Set<Pet>> response =
List<String> tags = null;
CompletableFuture<List<Pet>> response =
api.findPetsByTags(tags);
// TODO: test validations

View File

@@ -0,0 +1,56 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AppleReq
*/
public class AppleReqTest {
private final AppleReq model = new AppleReq();
/**
* Model tests for AppleReq
*/
@Test
public void testAppleReq() {
// TODO: test AppleReq
}
/**
* Test the property 'cultivar'
*/
@Test
public void cultivarTest() {
// TODO: test cultivar
}
/**
* Test the property 'mealy'
*/
@Test
public void mealyTest() {
// TODO: test mealy
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Apple
*/
public class AppleTest {
private final Apple model = new Apple();
/**
* Model tests for Apple
*/
@Test
public void testApple() {
// TODO: test Apple
}
/**
* Test the property 'cultivar'
*/
@Test
public void cultivarTest() {
// TODO: test cultivar
}
/**
* Test the property 'origin'
*/
@Test
public void originTest() {
// TODO: test origin
}
}

View File

@@ -0,0 +1,57 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for BananaReq
*/
public class BananaReqTest {
private final BananaReq model = new BananaReq();
/**
* Model tests for BananaReq
*/
@Test
public void testBananaReq() {
// TODO: test BananaReq
}
/**
* Test the property 'lengthCm'
*/
@Test
public void lengthCmTest() {
// TODO: test lengthCm
}
/**
* Test the property 'sweet'
*/
@Test
public void sweetTest() {
// TODO: test sweet
}
}

View File

@@ -0,0 +1,49 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Banana
*/
public class BananaTest {
private final Banana model = new Banana();
/**
* Model tests for Banana
*/
@Test
public void testBanana() {
// TODO: test Banana
}
/**
* Test the property 'lengthCm'
*/
@Test
public void lengthCmTest() {
// TODO: test lengthCm
}
}

View File

@@ -0,0 +1,48 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for BasquePig
*/
public class BasquePigTest {
private final BasquePig model = new BasquePig();
/**
* Model tests for BasquePig
*/
@Test
public void testBasquePig() {
// TODO: test BasquePig
}
/**
* Test the property 'className'
*/
@Test
public void classNameTest() {
// TODO: test className
}
}

View File

@@ -0,0 +1,58 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Set;
import java.util.HashSet;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ChildCatAllOf
*/
public class ChildCatAllOfTest {
private final ChildCatAllOf model = new ChildCatAllOf();
/**
* Model tests for ChildCatAllOf
*/
@Test
public void testChildCatAllOf() {
// TODO: test ChildCatAllOf
}
/**
* Test the property 'name'
*/
@Test
public void nameTest() {
// TODO: test name
}
/**
* Test the property 'petType'
*/
@Test
public void petTypeTest() {
// TODO: test petType
}
}

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.client.model.ParentPet;
import java.util.Set;
import java.util.HashSet;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ChildCat
*/
public class ChildCatTest {
private final ChildCat model = new ChildCat();
/**
* Model tests for ChildCat
*/
@Test
public void testChildCat() {
// TODO: test ChildCat
}
/**
* Test the property 'petType'
*/
@Test
public void petTypeTest() {
// TODO: test petType
}
/**
* Test the property 'name'
*/
@Test
public void nameTest() {
// TODO: test name
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ComplexQuadrilateral
*/
public class ComplexQuadrilateralTest {
private final ComplexQuadrilateral model = new ComplexQuadrilateral();
/**
* Model tests for ComplexQuadrilateral
*/
@Test
public void testComplexQuadrilateral() {
// TODO: test ComplexQuadrilateral
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'quadrilateralType'
*/
@Test
public void quadrilateralTypeTest() {
// TODO: test quadrilateralType
}
}

View File

@@ -0,0 +1,48 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for DanishPig
*/
public class DanishPigTest {
private final DanishPig model = new DanishPig();
/**
* Model tests for DanishPig
*/
@Test
public void testDanishPig() {
// TODO: test DanishPig
}
/**
* Test the property 'className'
*/
@Test
public void classNameTest() {
// TODO: test className
}
}

View File

@@ -0,0 +1,84 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.client.model.Fruit;
import org.openapitools.client.model.NullableShape;
import org.openapitools.client.model.Shape;
import org.openapitools.client.model.ShapeOrNull;
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 Drawing
*/
public class DrawingTest {
private final Drawing model = new Drawing();
/**
* Model tests for Drawing
*/
@Test
public void testDrawing() {
// TODO: test Drawing
}
/**
* Test the property 'mainShape'
*/
@Test
public void mainShapeTest() {
// TODO: test mainShape
}
/**
* Test the property 'shapeOrNull'
*/
@Test
public void shapeOrNullTest() {
// TODO: test shapeOrNull
}
/**
* Test the property 'nullableShape'
*/
@Test
public void nullableShapeTest() {
// TODO: test nullableShape
}
/**
* Test the property 'shapes'
*/
@Test
public void shapesTest() {
// TODO: test shapes
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for EquilateralTriangle
*/
public class EquilateralTriangleTest {
private final EquilateralTriangle model = new EquilateralTriangle();
/**
* Model tests for EquilateralTriangle
*/
@Test
public void testEquilateralTriangle() {
// TODO: test EquilateralTriangle
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'triangleType'
*/
@Test
public void triangleTypeTest() {
// TODO: test triangleType
}
}

View File

@@ -0,0 +1,75 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.openapitools.client.model.AppleReq;
import org.openapitools.client.model.BananaReq;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for FruitReq
*/
public class FruitReqTest {
private final FruitReq model = new FruitReq();
/**
* Model tests for FruitReq
*/
@Test
public void testFruitReq() {
// TODO: test FruitReq
}
/**
* Test the property 'cultivar'
*/
@Test
public void cultivarTest() {
// TODO: test cultivar
}
/**
* Test the property 'mealy'
*/
@Test
public void mealyTest() {
// TODO: test mealy
}
/**
* Test the property 'lengthCm'
*/
@Test
public void lengthCmTest() {
// TODO: test lengthCm
}
/**
* Test the property 'sweet'
*/
@Test
public void sweetTest() {
// TODO: test sweet
}
}

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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.openapitools.client.model.Apple;
import org.openapitools.client.model.Banana;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Fruit
*/
public class FruitTest {
private final Fruit model = new Fruit();
/**
* Model tests for Fruit
*/
@Test
public void testFruit() {
// TODO: test Fruit
}
/**
* Test the property 'cultivar'
*/
@Test
public void cultivarTest() {
// TODO: test cultivar
}
/**
* Test the property 'origin'
*/
@Test
public void originTest() {
// TODO: test origin
}
/**
* Test the property 'lengthCm'
*/
@Test
public void lengthCmTest() {
// TODO: test lengthCm
}
}

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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.openapitools.client.model.Apple;
import org.openapitools.client.model.Banana;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for GmFruit
*/
public class GmFruitTest {
private final GmFruit model = new GmFruit();
/**
* Model tests for GmFruit
*/
@Test
public void testGmFruit() {
// TODO: test GmFruit
}
/**
* Test the property 'cultivar'
*/
@Test
public void cultivarTest() {
// TODO: test cultivar
}
/**
* Test the property 'origin'
*/
@Test
public void originTest() {
// TODO: test origin
}
/**
* Test the property 'lengthCm'
*/
@Test
public void lengthCmTest() {
// TODO: test lengthCm
}
}

View File

@@ -0,0 +1,53 @@
/*
* 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.ChildCat;
import org.openapitools.client.model.ParentPet;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for GrandparentAnimal
*/
public class GrandparentAnimalTest {
private final GrandparentAnimal model = new GrandparentAnimal();
/**
* Model tests for GrandparentAnimal
*/
@Test
public void testGrandparentAnimal() {
// TODO: test GrandparentAnimal
}
/**
* Test the property 'petType'
*/
@Test
public void petTypeTest() {
// TODO: test petType
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for IsoscelesTriangle
*/
public class IsoscelesTriangleTest {
private final IsoscelesTriangle model = new IsoscelesTriangle();
/**
* Model tests for IsoscelesTriangle
*/
@Test
public void testIsoscelesTriangle() {
// TODO: test IsoscelesTriangle
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'triangleType'
*/
@Test
public void triangleTypeTest() {
// TODO: test triangleType
}
}

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.Pig;
import org.openapitools.client.model.Whale;
import org.openapitools.client.model.Zebra;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Mammal
*/
public class MammalTest {
private final Mammal model = new Mammal();
/**
* Model tests for Mammal
*/
@Test
public void testMammal() {
// TODO: test Mammal
}
/**
* Test the property 'hasBaleen'
*/
@Test
public void hasBaleenTest() {
// TODO: test hasBaleen
}
/**
* Test the property 'hasTeeth'
*/
@Test
public void hasTeethTest() {
// TODO: test hasTeeth
}
/**
* Test the property 'className'
*/
@Test
public void classNameTest() {
// TODO: test className
}
/**
* Test the property 'type'
*/
@Test
public void typeTest() {
// TODO: test type
}
}

View File

@@ -0,0 +1,69 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.Quadrilateral;
import org.openapitools.client.model.Triangle;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for NullableShape
*/
public class NullableShapeTest {
private final NullableShape model = new NullableShape();
/**
* Model tests for NullableShape
*/
@Test
public void testNullableShape() {
// TODO: test NullableShape
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'triangleType'
*/
@Test
public void triangleTypeTest() {
// TODO: test triangleType
}
/**
* Test the property 'quadrilateralType'
*/
@Test
public void quadrilateralTypeTest() {
// TODO: test quadrilateralType
}
}

View File

@@ -0,0 +1,53 @@
/*
* 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.ChildCat;
import org.openapitools.client.model.GrandparentAnimal;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ParentPet
*/
public class ParentPetTest {
private final ParentPet model = new ParentPet();
/**
* Model tests for ParentPet
*/
@Test
public void testParentPet() {
// TODO: test ParentPet
}
/**
* Test the property 'petType'
*/
@Test
public void petTypeTest() {
// TODO: test petType
}
}

View File

@@ -0,0 +1,53 @@
/*
* 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.BasquePig;
import org.openapitools.client.model.DanishPig;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Pig
*/
public class PigTest {
private final Pig model = new Pig();
/**
* Model tests for Pig
*/
@Test
public void testPig() {
// TODO: test Pig
}
/**
* Test the property 'className'
*/
@Test
public void classNameTest() {
// TODO: test className
}
}

View File

@@ -0,0 +1,48 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for QuadrilateralInterface
*/
public class QuadrilateralInterfaceTest {
private final QuadrilateralInterface model = new QuadrilateralInterface();
/**
* Model tests for QuadrilateralInterface
*/
@Test
public void testQuadrilateralInterface() {
// TODO: test QuadrilateralInterface
}
/**
* Test the property 'quadrilateralType'
*/
@Test
public void quadrilateralTypeTest() {
// TODO: test quadrilateralType
}
}

View File

@@ -0,0 +1,61 @@
/*
* 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.ComplexQuadrilateral;
import org.openapitools.client.model.SimpleQuadrilateral;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Quadrilateral
*/
public class QuadrilateralTest {
private final Quadrilateral model = new Quadrilateral();
/**
* Model tests for Quadrilateral
*/
@Test
public void testQuadrilateral() {
// TODO: test Quadrilateral
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'quadrilateralType'
*/
@Test
public void quadrilateralTypeTest() {
// TODO: test quadrilateralType
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ScaleneTriangle
*/
public class ScaleneTriangleTest {
private final ScaleneTriangle model = new ScaleneTriangle();
/**
* Model tests for ScaleneTriangle
*/
@Test
public void testScaleneTriangle() {
// TODO: test ScaleneTriangle
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'triangleType'
*/
@Test
public void triangleTypeTest() {
// TODO: test triangleType
}
}

View File

@@ -0,0 +1,48 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ShapeInterface
*/
public class ShapeInterfaceTest {
private final ShapeInterface model = new ShapeInterface();
/**
* Model tests for ShapeInterface
*/
@Test
public void testShapeInterface() {
// TODO: test ShapeInterface
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
}

View File

@@ -0,0 +1,69 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.Quadrilateral;
import org.openapitools.client.model.Triangle;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ShapeOrNull
*/
public class ShapeOrNullTest {
private final ShapeOrNull model = new ShapeOrNull();
/**
* Model tests for ShapeOrNull
*/
@Test
public void testShapeOrNull() {
// TODO: test ShapeOrNull
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'triangleType'
*/
@Test
public void triangleTypeTest() {
// TODO: test triangleType
}
/**
* Test the property 'quadrilateralType'
*/
@Test
public void quadrilateralTypeTest() {
// TODO: test quadrilateralType
}
}

View File

@@ -0,0 +1,69 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.Quadrilateral;
import org.openapitools.client.model.Triangle;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Shape
*/
public class ShapeTest {
private final Shape model = new Shape();
/**
* Model tests for Shape
*/
@Test
public void testShape() {
// TODO: test Shape
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'triangleType'
*/
@Test
public void triangleTypeTest() {
// TODO: test triangleType
}
/**
* Test the property 'quadrilateralType'
*/
@Test
public void quadrilateralTypeTest() {
// TODO: test quadrilateralType
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for SimpleQuadrilateral
*/
public class SimpleQuadrilateralTest {
private final SimpleQuadrilateral model = new SimpleQuadrilateral();
/**
* Model tests for SimpleQuadrilateral
*/
@Test
public void testSimpleQuadrilateral() {
// TODO: test SimpleQuadrilateral
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'quadrilateralType'
*/
@Test
public void quadrilateralTypeTest() {
// TODO: test quadrilateralType
}
}

View File

@@ -0,0 +1,48 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for TriangleInterface
*/
public class TriangleInterfaceTest {
private final TriangleInterface model = new TriangleInterface();
/**
* Model tests for TriangleInterface
*/
@Test
public void testTriangleInterface() {
// TODO: test TriangleInterface
}
/**
* Test the property 'triangleType'
*/
@Test
public void triangleTypeTest() {
// TODO: test triangleType
}
}

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.client.model.EquilateralTriangle;
import org.openapitools.client.model.IsoscelesTriangle;
import org.openapitools.client.model.ScaleneTriangle;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Triangle
*/
public class TriangleTest {
private final Triangle model = new Triangle();
/**
* Model tests for Triangle
*/
@Test
public void testTriangle() {
// TODO: test Triangle
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'triangleType'
*/
@Test
public void triangleTypeTest() {
// TODO: test triangleType
}
}

View File

@@ -0,0 +1,64 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Whale
*/
public class WhaleTest {
private final Whale model = new Whale();
/**
* Model tests for Whale
*/
@Test
public void testWhale() {
// TODO: test Whale
}
/**
* Test the property 'hasBaleen'
*/
@Test
public void hasBaleenTest() {
// TODO: test hasBaleen
}
/**
* Test the property 'hasTeeth'
*/
@Test
public void hasTeethTest() {
// TODO: test hasTeeth
}
/**
* Test the property 'className'
*/
@Test
public void classNameTest() {
// TODO: test className
}
}

View File

@@ -0,0 +1,58 @@
/*
* 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Zebra
*/
public class ZebraTest {
private final Zebra model = new Zebra();
/**
* Model tests for Zebra
*/
@Test
public void testZebra() {
// TODO: test Zebra
}
/**
* Test the property 'type'
*/
@Test
public void typeTest() {
// TODO: test type
}
/**
* Test the property 'className'
*/
@Test
public void classNameTest() {
// TODO: test className
}
}