diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache index 3f999481db2c..67b0ca6f0ab9 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache @@ -54,6 +54,7 @@ import java.util.List; import java.util.Arrays; import java.util.ArrayList; import java.util.Date; +import java.util.Locale; import java.util.stream.Collectors; import java.util.stream.Stream; {{#jsr310}} @@ -1196,6 +1197,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @param authNames The authentications to apply * @param returnType The return type into which to deserialize the response * @param isBodyNullable True if the body is nullable + * @param errorTypes Mapping of error codes to types into which to deserialize the response * @return The response body in type of string * @throws ApiException API exception */ @@ -1212,7 +1214,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { String contentType, String[] authNames, GenericType returnType, - boolean isBodyNullable) + boolean isBodyNullable, + Map errorTypes + ) throws ApiException { String targetURL; @@ -1223,7 +1227,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { if (index < 0 || index >= serverConfigurations.size()) { throw new ArrayIndexOutOfBoundsException( String.format( - java.util.Locale.ROOT, + Locale.ROOT, "Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size())); } @@ -1333,6 +1337,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { String respBody = null; if (response.hasEntity()) { try { + // call bufferEntity, so that a subsequent call to `readEntity` in `deserialize` doesn't fail + response.bufferEntity(); respBody = String.valueOf(response.readEntity(String.class)); message = respBody; } catch (RuntimeException e) { @@ -1340,7 +1346,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } } throw new ApiException( - response.getStatus(), message, buildResponseHeaders(response), respBody); + response.getStatus(), message, buildResponseHeaders(response), respBody, deserializeErrorEntity(errorTypes, response)); } } finally { try { @@ -1351,6 +1357,30 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } } } + + /** + * Deserialize the response body into an error entity based on HTTP status code. + * Looks up the error type from the errorTypes map using the response status code, + * or falls back to the "default" error type if no match is found. + * + * @param errorTypes Map of status code strings to GenericType for deserialization + * @param response The HTTP response + * @return The deserialized error entity, or null if not found or deserialization fails + */ + private Object deserializeErrorEntity(Map errorTypes, Response response) { + if (errorTypes == null) { + return null; + } + GenericType errorType = errorTypes.get(String.valueOf(response.getStatus())); + if (errorType == null) { + errorType = errorTypes.get("0"); // "0" is the "default" response + } + try { + return deserialize(response, errorType); + } catch (Exception e) { + return null; + } + } protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity entity) { Response response; @@ -1377,7 +1407,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { */ @Deprecated public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType, boolean isBodyNullable) throws ApiException { - return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, isBodyNullable); + return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, isBodyNullable, null/*TODO SME manage*/); } /** diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api.mustache index c663d7580a7e..03210490afb7 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api.mustache @@ -195,12 +195,20 @@ public class {{classname}} { {{#hasAuthMethods}} String[] localVarAuthNames = {{=% %=}}new String[] {%#authMethods%"%name%"%^-last%, %/-last%%/authMethods%};%={{ }}=% {{/hasAuthMethods}} + final Map localVarErrorTypes = new HashMap(); + {{#responses}} + {{^-first}} + {{#dataType}} + localVarErrorTypes.put("{{code}}", new GenericType<{{{dataType}}}>() {}); + {{/dataType}} + {{/-first}} + {{/responses}} {{#returnType}} GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; {{/returnType}} return apiClient.invokeAPI("{{classname}}.{{operationId}}", {{#hasPathParams}}localVarPath{{/hasPathParams}}{{^hasPathParams}}"{{{path}}}"{{/hasPathParams}}, "{{httpMethod}}", {{#queryParams}}{{#-first}}localVarQueryParams{{/-first}}{{/queryParams}}{{^queryParams}}new ArrayList<>(){{/queryParams}}, {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}, {{#headerParams}}{{#-first}}localVarHeaderParams{{/-first}}{{/headerParams}}{{^headerParams}}new LinkedHashMap<>(){{/headerParams}}, {{#cookieParams}}{{#-first}}localVarCookieParams{{/-first}}{{/cookieParams}}{{^cookieParams}}new LinkedHashMap<>(){{/cookieParams}}, {{#formParams}}{{#-first}}localVarFormParams{{/-first}}{{/formParams}}{{^formParams}}new LinkedHashMap<>(){{/formParams}}, localVarAccept, localVarContentType, - {{#hasAuthMethods}}localVarAuthNames{{/hasAuthMethods}}{{^hasAuthMethods}}null{{/hasAuthMethods}}, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, {{#bodyParam}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}false{{/bodyParam}}); + {{#hasAuthMethods}}localVarAuthNames{{/hasAuthMethods}}{{^hasAuthMethods}}null{{/hasAuthMethods}}, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, {{#bodyParam}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}false{{/bodyParam}}, localVarErrorTypes); } {{#vendorExtensions.x-group-parameters}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/apiException.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/apiException.mustache index d957acd81fd1..e3b40f7d6cca 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/apiException.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/apiException.mustache @@ -20,6 +20,7 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us private int code = 0; private Map> responseHeaders = null; private String responseBody = null; + private Object errorEntity = null; public ApiException() {} @@ -73,6 +74,11 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us this.responseBody = responseBody; } + public ApiException(int code, String message, Map> responseHeaders, String responseBody, Object errorEntity) { + this(code, message, responseHeaders, responseBody); + this.errorEntity = errorEntity; + } + /** * Get the HTTP status code. * @@ -99,4 +105,13 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us public String getResponseBody() { return responseBody; } + + /** + * Get the deserialized error entity (or null if this error doesn't have a model associated). + * + * @return Deserialized error entity + */ + public Object getErrorEntity() { + return errorEntity; + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jersey3/JavaJersey3ErrorEntityFunctionalTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jersey3/JavaJersey3ErrorEntityFunctionalTest.java new file mode 100644 index 000000000000..4ac873f3428e --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jersey3/JavaJersey3ErrorEntityFunctionalTest.java @@ -0,0 +1,124 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.java.jersey3; + +import org.testng.annotations.Test; + +import java.util.HashMap; +import java.util.Map; + +import static org.testng.Assert.*; + +/** + * Functional test for errorEntity deserialization feature. + * + * This test verifies that the generated code includes the errorEntity + * field and getErrorEntity() method by examining the generated templates. + * + * Full integration tests would require: + * 1. A running mock HTTP server + * 2. Generated client code compiled and executed + * 3. Actual API calls to verify runtime behavior + * + * The client's original project (BudgetApiTest) provides this type of + * functional testing. This test verifies the template structure is correct. + */ +public class JavaJersey3ErrorEntityFunctionalTest { + + private static final String JERSEY3_TEMPLATE_DIR = + "src/main/resources/Java/libraries/jersey3/"; + + /** + * Verify generated code includes errorEntity field in ApiException + */ + @Test + public void testGeneratedApiExceptionHasErrorEntity() throws Exception { + String template = readTemplate("apiException.mustache"); + assertNotNull(template); + + // Verify errorEntity field exists + assertTrue(template.contains("private Object errorEntity = null"), + "Generated ApiException should have errorEntity field"); + + // Verify getErrorEntity() method exists + assertTrue(template.contains("public Object getErrorEntity()"), + "Generated ApiException should have getErrorEntity() method"); + + // Verify constructor with errorEntity parameter + assertTrue(template.contains("Object errorEntity"), + "Generated ApiException should accept errorEntity in constructor"); + } + + /** + * Verify generated code includes deserializeErrorEntity method + */ + @Test + public void testGeneratedApiClientHasDeserializeErrorEntity() throws Exception { + String template = readTemplate("ApiClient.mustache"); + assertNotNull(template); + + // Verify deserializeErrorEntity method exists + assertTrue(template.contains("deserializeErrorEntity"), + "Generated ApiClient should have deserializeErrorEntity method"); + + // Verify errorTypes parameter handling + assertTrue(template.contains("Map errorTypes"), + "Generated ApiClient should handle errorTypes parameter"); + } + + /** + * Verify generated API methods build error types map + */ + @Test + public void testGeneratedApiMethodsBuildErrorTypesMap() throws Exception { + String template = readTemplate("api.mustache"); + assertNotNull(template); + + // Verify localVarErrorTypes is built + assertTrue(template.contains("localVarErrorTypes"), + "Generated API methods should build localVarErrorTypes"); + + // Verify error types are put into the map + assertTrue(template.contains("localVarErrorTypes.put"), + "Generated API methods should put error types into map"); + } + + /** + * Verify null is returned when deserialization fails + */ + @Test + public void testDeserializationReturnsNullOnFailure() throws Exception { + String template = readTemplate("ApiClient.mustache"); + assertNotNull(template); + + // Verify that on exception, null is returned (not error message) + // This is the fix we applied for the P2 issue + assertFalse(template.contains("String.format(\"Failed deserializing"), + "deserializeErrorEntity should return null, not error message string"); + } + + /** + * Helper method to read template files + */ + private String readTemplate(String templateName) throws Exception { + java.nio.file.Path templatePath = java.nio.file.Paths.get(JERSEY3_TEMPLATE_DIR + templateName); + if (java.nio.file.Files.exists(templatePath)) { + return java.nio.file.Files.readString(templatePath); + } + return null; + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jersey3/JavaJersey3ErrorEntityTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jersey3/JavaJersey3ErrorEntityTest.java new file mode 100644 index 000000000000..290ea2b251dc --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jersey3/JavaJersey3ErrorEntityTest.java @@ -0,0 +1,150 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.java.jersey3; + +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Tests for error entity deserialization in jersey3 client + * + * These tests verify that the templates generate the correct code + * for errorEntity feature (issue #4777) + */ +public class JavaJersey3ErrorEntityTest { + + private static final String JERSEY3_TEMPLATE_DIR = + "src/main/resources/Java/libraries/jersey3/"; + + /** + * Test that apiException.mustache contains errorEntity field + */ + @Test + public void testApiExceptionHasErrorEntityField() throws Exception { + String template = readTemplate("apiException.mustache"); + assertNotNull(template, "apiException.mustache should exist"); + assertTrue(template.contains("errorEntity"), + "apiException.mustache should contain 'errorEntity' field"); + } + + /** + * Test that apiException.mustache contains getErrorEntity method + */ + @Test + public void testApiExceptionHasGetErrorEntityMethod() throws Exception { + String template = readTemplate("apiException.mustache"); + assertNotNull(template); + assertTrue(template.contains("getErrorEntity"), + "apiException.mustache should contain 'getErrorEntity()' method"); + } + + /** + * Test that ApiClient.mustache contains deserializeErrorEntity method + */ + @Test + public void testApiClientHasDeserializeErrorEntityMethod() throws Exception { + String template = readTemplate("ApiClient.mustache"); + assertNotNull(template); + assertTrue(template.contains("deserializeErrorEntity"), + "ApiClient.mustache should contain 'deserializeErrorEntity' method"); + } + + /** + * Test that api.mustache contains localVarErrorTypes + */ + @Test + public void testApiGeneratesErrorTypesMap() throws Exception { + String template = readTemplate("api.mustache"); + assertNotNull(template); + assertTrue(template.contains("localVarErrorTypes"), + "api.mustache should contain 'localVarErrorTypes'"); + } + + /** + * Test that invokeAPI accepts errorTypes parameter + */ + @Test + public void testInvokeAPIHasErrorTypesParameter() throws Exception { + String template = readTemplate("ApiClient.mustache"); + assertNotNull(template); + assertTrue(template.contains("errorTypes"), + "ApiClient.mustache should contain 'errorTypes' parameter"); + } + + /** + * Test that template handles "default" response (uses "0" as key) + */ + @Test + public void testDefaultResponseHandling() throws Exception { + String template = readTemplate("ApiClient.mustache"); + assertNotNull(template); + assertTrue(template.contains("\"0\""), + "ApiClient.mustache should handle 'default' response with '0' key"); + } + + /** + * Test error types map building pattern + */ + @Test + public void testErrorTypesMapBuildingPattern() throws Exception { + String template = readTemplate("api.mustache"); + assertNotNull(template); + // Check pattern: localVarErrorTypes.put("code", new GenericType<...>) + assertTrue(template.contains("localVarErrorTypes.put"), + "api.mustache should build error types map using put"); + } + + /** + * Test backward compatibility - null is passed for errorTypes + */ + @Test + public void testBackwardCompatibility() throws Exception { + String template = readTemplate("ApiClient.mustache"); + assertNotNull(template); + // Check that null is passed for backward compatibility + assertTrue(template.contains(", null") || + template.contains("null,") || + template.contains("null/*"), + "Backwards compatibility: null should be passed for errorTypes"); + } + + /** + * Helper method to read template files + */ + private String readTemplate(String templateName) throws Exception { + java.nio.file.Path templatePath = java.nio.file.Paths.get( + JERSEY3_TEMPLATE_DIR + templateName); + if (!java.nio.file.Files.exists(templatePath)) { + // Try alternate path + templatePath = java.nio.file.Paths.get( + "modules/openapi-generator/" + JERSEY3_TEMPLATE_DIR + templateName); + } + if (java.nio.file.Files.exists(templatePath)) { + return java.nio.file.Files.readString(templatePath); + } + // Try classpath + try { + java.io.InputStream is = getClass().getClassLoader() + .getResourceAsStream(JERSEY3_TEMPLATE_DIR + templateName); + if (is != null) { + return new String(is.readAllBytes(), java.nio.charset.StandardCharsets.UTF_8); + } + } catch (Exception ignored) {} + + return null; + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/jersey3-oneOf/pom.xml b/samples/client/petstore/java/jersey3-oneOf/pom.xml index 94aea8af5e82..c0d7a05a48f2 100644 --- a/samples/client/petstore/java/jersey3-oneOf/pom.xml +++ b/samples/client/petstore/java/jersey3-oneOf/pom.xml @@ -318,6 +318,25 @@ jersey-apache-connector ${jersey-version} + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + + org.apache.commons + commons-lang3 + ${commons-lang3-version} + + + + org.tomitribe + tomitribe-http-signatures + ${http-signature-version} + @@ -336,6 +355,8 @@ 0.2.10 2.1.1 3.0.2 + 3.12.0 + 1.8 5.10.0 2.21.0 diff --git a/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiClient.java index bbebf6553cd2..83834edcf4b2 100644 --- a/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiClient.java @@ -62,6 +62,7 @@ import java.util.Arrays; import java.util.ArrayList; import java.util.Date; +import java.util.Locale; import java.util.stream.Collectors; import java.util.stream.Stream; import java.time.OffsetDateTime; @@ -974,6 +975,7 @@ public File prepareDownloadFile(Response response) throws IOException { * @param authNames The authentications to apply * @param returnType The return type into which to deserialize the response * @param isBodyNullable True if the body is nullable + * @param errorTypes Mapping of error codes to types into which to deserialize the response * @return The response body in type of string * @throws ApiException API exception */ @@ -990,7 +992,9 @@ public ApiResponse invokeAPI( String contentType, String[] authNames, GenericType returnType, - boolean isBodyNullable) + boolean isBodyNullable, + Map errorTypes + ) throws ApiException { String targetURL; @@ -1001,7 +1005,7 @@ public ApiResponse invokeAPI( if (index < 0 || index >= serverConfigurations.size()) { throw new ArrayIndexOutOfBoundsException( String.format( - java.util.Locale.ROOT, + Locale.ROOT, "Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size())); } @@ -1088,6 +1092,8 @@ public ApiResponse invokeAPI( String respBody = null; if (response.hasEntity()) { try { + // call bufferEntity, so that a subsequent call to `readEntity` in `deserialize` doesn't fail + response.bufferEntity(); respBody = String.valueOf(response.readEntity(String.class)); message = respBody; } catch (RuntimeException e) { @@ -1095,7 +1101,7 @@ public ApiResponse invokeAPI( } } throw new ApiException( - response.getStatus(), message, buildResponseHeaders(response), respBody); + response.getStatus(), message, buildResponseHeaders(response), respBody, deserializeErrorEntity(errorTypes, response)); } } finally { try { @@ -1106,6 +1112,30 @@ public ApiResponse invokeAPI( } } } + + /** + * Deserialize the response body into an error entity based on HTTP status code. + * Looks up the error type from the errorTypes map using the response status code, + * or falls back to the "default" error type if no match is found. + * + * @param errorTypes Map of status code strings to GenericType for deserialization + * @param response The HTTP response + * @return The deserialized error entity, or null if not found or deserialization fails + */ + private Object deserializeErrorEntity(Map errorTypes, Response response) { + if (errorTypes == null) { + return null; + } + GenericType errorType = errorTypes.get(String.valueOf(response.getStatus())); + if (errorType == null) { + errorType = errorTypes.get("0"); // "0" is the "default" response + } + try { + return deserialize(response, errorType); + } catch (Exception e) { + return null; + } + } protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity entity) { Response response; @@ -1132,7 +1162,7 @@ protected Response sendRequest(String method, Invocation.Builder invocationBuild */ @Deprecated public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType, boolean isBodyNullable) throws ApiException { - return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, isBodyNullable); + return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, isBodyNullable, null/*TODO SME manage*/); } /** diff --git a/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiException.java index 21d1a3d7b956..ec49f50d4456 100644 --- a/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiException.java @@ -26,6 +26,7 @@ public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; private String responseBody = null; + private Object errorEntity = null; public ApiException() {} @@ -67,6 +68,11 @@ public ApiException(int code, String message, Map> response this.responseBody = responseBody; } + public ApiException(int code, String message, Map> responseHeaders, String responseBody, Object errorEntity) { + this(code, message, responseHeaders, responseBody); + this.errorEntity = errorEntity; + } + /** * Get the HTTP status code. * @@ -93,4 +99,13 @@ public Map> getResponseHeaders() { public String getResponseBody() { return responseBody; } + + /** + * Get the deserialized error entity (or null if this error doesn't have a model associated). + * + * @return Deserialized error entity + */ + public Object getErrorEntity() { + return errorEntity; + } } diff --git a/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/api/DefaultApi.java index 77eee862c4d9..30e535d164ba 100644 --- a/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -78,8 +78,9 @@ public void rootPost(@jakarta.annotation.Nullable PostRequest postRequest) throw public ApiResponse rootPostWithHttpInfo(@jakarta.annotation.Nullable PostRequest postRequest) throws ApiException { String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("DefaultApi.rootPost", "/", "POST", new ArrayList<>(), postRequest, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } } diff --git a/samples/client/petstore/java/jersey3/README.md b/samples/client/petstore/java/jersey3/README.md index 0ff5521aaadb..e1421b2e789b 100644 --- a/samples/client/petstore/java/jersey3/README.md +++ b/samples/client/petstore/java/jersey3/README.md @@ -1,4 +1,4 @@ -# petstore-jersey3 +# openapi-java-client OpenAPI Petstore @@ -41,7 +41,7 @@ Add this dependency to your project's POM: ```xml org.openapitools - petstore-jersey3 + openapi-java-client 1.0.0 compile @@ -53,12 +53,12 @@ Add this dependency to your project's build file: ```groovy repositories { - mavenCentral() // Needed if the 'petstore-jersey3' jar has been published to maven central. - mavenLocal() // Needed if the 'petstore-jersey3' jar has been published to the local maven repo. + mavenCentral() // Needed if the 'openapi-java-client' jar has been published to maven central. + mavenLocal() // Needed if the 'openapi-java-client' jar has been published to the local maven repo. } dependencies { - implementation "org.openapitools:petstore-jersey3:1.0.0" + implementation "org.openapitools:openapi-java-client:1.0.0" } ``` @@ -72,7 +72,7 @@ mvn clean package Then manually install the following JARs: -- `target/petstore-jersey3-1.0.0.jar` +- `target/openapi-java-client-1.0.0.jar` - `target/lib/*.jar` ## Getting Started diff --git a/samples/client/petstore/java/jersey3/build.gradle b/samples/client/petstore/java/jersey3/build.gradle index 0b26c0545286..6f430b1f248d 100644 --- a/samples/client/petstore/java/jersey3/build.gradle +++ b/samples/client/petstore/java/jersey3/build.gradle @@ -84,7 +84,7 @@ if(hasProperty('target') && target == 'android') { publishing { publications { maven(MavenPublication) { - artifactId = 'petstore-jersey3' + artifactId = 'openapi-java-client' from components.java } @@ -104,12 +104,10 @@ ext { jackson_databind_version = "2.21.1" jackson_databind_nullable_version = "0.2.10" jakarta_annotation_version = "2.1.0" - bean_validation_version = "3.0.2" jersey_version = "3.0.4" junit_version = "5.8.2" scribejava_apis_version = "8.3.1" tomitribe_http_signatures_version = "1.7" - commons_lang3_version = "3.17.0" } dependencies { @@ -128,8 +126,6 @@ dependencies { implementation "com.github.scribejava:scribejava-apis:$scribejava_apis_version" implementation "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version" implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - implementation "jakarta.validation:jakarta.validation-api:$bean_validation_version" - implementation "org.apache.commons:commons-lang3:$commons_lang3_version" testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" } diff --git a/samples/client/petstore/java/jersey3/build.sbt b/samples/client/petstore/java/jersey3/build.sbt index ef9f97ebb175..57ccccb87052 100644 --- a/samples/client/petstore/java/jersey3/build.sbt +++ b/samples/client/petstore/java/jersey3/build.sbt @@ -1,7 +1,7 @@ lazy val root = (project in file(".")). settings( organization := "org.openapitools", - name := "petstore-jersey3", + name := "openapi-java-client", version := "1.0.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), @@ -24,7 +24,6 @@ lazy val root = (project in file(".")). "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", "org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "2.1.0" % "compile", - "org.apache.commons" % "commons-lang3" % "3.17.0" % "compile", "org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test" ) ) diff --git a/samples/client/petstore/java/jersey3/docs/ArrayTest.md b/samples/client/petstore/java/jersey3/docs/ArrayTest.md index ae2672809aa9..36077c9df300 100644 --- a/samples/client/petstore/java/jersey3/docs/ArrayTest.md +++ b/samples/client/petstore/java/jersey3/docs/ArrayTest.md @@ -9,7 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**arrayOfString** | **List<String>** | | [optional] | |**arrayArrayOfInteger** | **List<List<Long>>** | | [optional] | -|**arrayArrayOfModel** | **List<List<@Valid ReadOnlyFirst>>** | | [optional] | +|**arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] | diff --git a/samples/client/petstore/java/jersey3/docs/FakeApi.md b/samples/client/petstore/java/jersey3/docs/FakeApi.md index 7d45cd6a51b8..3816afc1ce7c 100644 --- a/samples/client/petstore/java/jersey3/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey3/docs/FakeApi.md @@ -427,7 +427,7 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); FakeApi apiInstance = new FakeApi(defaultClient); - List<@Pattern(regexp = "[A-Z0-9]+")String> requestBody = Arrays.asList(); // List<@Pattern(regexp = "[A-Z0-9]+")String> | + List requestBody = Arrays.asList(); // List | try { apiInstance.postArrayOfString(requestBody); } catch (ApiException e) { diff --git a/samples/client/petstore/java/jersey3/docs/UserApi.md b/samples/client/petstore/java/jersey3/docs/UserApi.md index 091549fc7c8f..6df604acce37 100644 --- a/samples/client/petstore/java/jersey3/docs/UserApi.md +++ b/samples/client/petstore/java/jersey3/docs/UserApi.md @@ -103,7 +103,7 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); UserApi apiInstance = new UserApi(defaultClient); - List<@Valid User> user = Arrays.asList(); // List<@Valid User> | List of user object + List user = Arrays.asList(); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -167,7 +167,7 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); UserApi apiInstance = new UserApi(defaultClient); - List<@Valid User> user = Arrays.asList(); // List<@Valid User> | List of user object + List user = Arrays.asList(); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/jersey3/gradle.properties b/samples/client/petstore/java/jersey3/gradle.properties index d3e8e41ba6fb..a3408578278a 100644 --- a/samples/client/petstore/java/jersey3/gradle.properties +++ b/samples/client/petstore/java/jersey3/gradle.properties @@ -4,10 +4,3 @@ # Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties # For example, uncomment below to build for Android #target = android - -# JVM arguments -org.gradle.jvmargs=-Xmx2024m -XX:MaxPermSize=512m -# set timeout -org.gradle.daemon.idletimeout=3600000 -# show all warnings -org.gradle.warning.mode=all diff --git a/samples/client/petstore/java/jersey3/pom.xml b/samples/client/petstore/java/jersey3/pom.xml index faf628278687..ba2fa0a780ab 100644 --- a/samples/client/petstore/java/jersey3/pom.xml +++ b/samples/client/petstore/java/jersey3/pom.xml @@ -2,9 +2,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 org.openapitools - petstore-jersey3 + openapi-java-client jar - petstore-jersey3 + openapi-java-client 1.0.0 https://github.com/openapitools/openapi-generator OpenAPI Java @@ -317,13 +317,6 @@ scribejava-apis ${scribejava-apis-version} - - - jakarta.validation - jakarta.validation-api - ${beanvalidation-version} - provided - jakarta.annotation jakarta.annotation-api @@ -335,6 +328,13 @@ jersey-apache-connector ${jersey-version} + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + org.apache.commons @@ -359,10 +359,10 @@ 0.2.10 2.1.1 3.0.2 + 3.12.0 5.10.0 1.8 8.3.3 - 3.17.0 2.21.0 diff --git a/samples/client/petstore/java/jersey3/settings.gradle b/samples/client/petstore/java/jersey3/settings.gradle index b50c71ae7985..369ba54a9e06 100644 --- a/samples/client/petstore/java/jersey3/settings.gradle +++ b/samples/client/petstore/java/jersey3/settings.gradle @@ -1 +1 @@ -rootProject.name = "petstore-jersey3" \ No newline at end of file +rootProject.name = "openapi-java-client" \ No newline at end of file diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java index 2d13159dbe2d..8d0deb2d886b 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java @@ -63,6 +63,7 @@ import java.util.Arrays; import java.util.ArrayList; import java.util.Date; +import java.util.Locale; import java.util.stream.Collectors; import java.util.stream.Stream; import java.time.OffsetDateTime; @@ -1197,6 +1198,7 @@ public File prepareDownloadFile(Response response) throws IOException { * @param authNames The authentications to apply * @param returnType The return type into which to deserialize the response * @param isBodyNullable True if the body is nullable + * @param errorTypes Mapping of error codes to types into which to deserialize the response * @return The response body in type of string * @throws ApiException API exception */ @@ -1213,7 +1215,9 @@ public ApiResponse invokeAPI( String contentType, String[] authNames, GenericType returnType, - boolean isBodyNullable) + boolean isBodyNullable, + Map errorTypes + ) throws ApiException { String targetURL; @@ -1224,7 +1228,7 @@ public ApiResponse invokeAPI( if (index < 0 || index >= serverConfigurations.size()) { throw new ArrayIndexOutOfBoundsException( String.format( - java.util.Locale.ROOT, + Locale.ROOT, "Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size())); } @@ -1327,6 +1331,8 @@ public ApiResponse invokeAPI( String respBody = null; if (response.hasEntity()) { try { + // call bufferEntity, so that a subsequent call to `readEntity` in `deserialize` doesn't fail + response.bufferEntity(); respBody = String.valueOf(response.readEntity(String.class)); message = respBody; } catch (RuntimeException e) { @@ -1334,7 +1340,7 @@ public ApiResponse invokeAPI( } } throw new ApiException( - response.getStatus(), message, buildResponseHeaders(response), respBody); + response.getStatus(), message, buildResponseHeaders(response), respBody, deserializeErrorEntity(errorTypes, response)); } } finally { try { @@ -1345,6 +1351,30 @@ public ApiResponse invokeAPI( } } } + + /** + * Deserialize the response body into an error entity based on HTTP status code. + * Looks up the error type from the errorTypes map using the response status code, + * or falls back to the "default" error type if no match is found. + * + * @param errorTypes Map of status code strings to GenericType for deserialization + * @param response The HTTP response + * @return The deserialized error entity, or null if not found or deserialization fails + */ + private Object deserializeErrorEntity(Map errorTypes, Response response) { + if (errorTypes == null) { + return null; + } + GenericType errorType = errorTypes.get(String.valueOf(response.getStatus())); + if (errorType == null) { + errorType = errorTypes.get("0"); // "0" is the "default" response + } + try { + return deserialize(response, errorType); + } catch (Exception e) { + return null; + } + } protected Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity entity) { Response response; @@ -1371,7 +1401,7 @@ protected Response sendRequest(String method, Invocation.Builder invocationBuild */ @Deprecated public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType, boolean isBodyNullable) throws ApiException { - return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, isBodyNullable); + return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, isBodyNullable, null/*TODO SME manage*/); } /** diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiException.java index 70d3b0f5a071..6ac40b5d75c3 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiException.java @@ -26,6 +26,7 @@ public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; private String responseBody = null; + private Object errorEntity = null; public ApiException() {} @@ -67,6 +68,11 @@ public ApiException(int code, String message, Map> response this.responseBody = responseBody; } + public ApiException(int code, String message, Map> responseHeaders, String responseBody, Object errorEntity) { + this(code, message, responseHeaders, responseBody); + this.errorEntity = errorEntity; + } + /** * Get the HTTP status code. * @@ -93,4 +99,13 @@ public Map> getResponseHeaders() { public String getResponseBody() { return responseBody; } + + /** + * Get the deserialized error entity (or null if this error doesn't have a model associated). + * + * @return Deserialized error entity + */ + public Object getErrorEntity() { + return errorEntity; + } } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/JSON.java index d08e35ad2406..7136d534da1a 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/JSON.java @@ -35,7 +35,7 @@ public JSON() { mapper = JsonMapper.builder() .serializationInclusion(JsonInclude.Include.NON_NULL) .configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false) - .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 315aa5a06d8c..81e46331fd74 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -10,9 +10,6 @@ import org.openapitools.client.model.Client; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; - import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -87,9 +84,10 @@ public ApiResponse call123testSpecialTagsWithHttpInfo(@jakarta.annotatio String localVarAccept = apiClient.selectHeaderAccept("application/json"); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", "/another-fake/dummy", "PATCH", new ArrayList<>(), client, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/DefaultApi.java index 8e310f45b0ff..f9c2a8baa065 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -10,9 +10,6 @@ import org.openapitools.client.model.FooGetDefaultResponse; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; - import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -80,9 +77,10 @@ public FooGetDefaultResponse fooGet() throws ApiException { public ApiResponse fooGetWithHttpInfo() throws ApiException { String localVarAccept = apiClient.selectHeaderAccept("application/json"); String localVarContentType = apiClient.selectHeaderContentType(); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("DefaultApi.fooGet", "/foo", "GET", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeApi.java index 227bae0f78f2..69ee6b19482b 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeApi.java @@ -20,9 +20,6 @@ import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; import org.openapitools.client.model.User; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; - import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -90,10 +87,11 @@ public HealthCheckResult fakeHealthGet() throws ApiException { public ApiResponse fakeHealthGetWithHttpInfo() throws ApiException { String localVarAccept = apiClient.selectHeaderAccept("application/json"); String localVarContentType = apiClient.selectHeaderContentType(); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("FakeApi.fakeHealthGet", "/fake/health", "GET", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } /** * @@ -128,10 +126,11 @@ public Boolean fakeOuterBooleanSerialize(@jakarta.annotation.Nullable Boolean bo public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(@jakarta.annotation.Nullable Boolean body) throws ApiException { String localVarAccept = apiClient.selectHeaderAccept("*/*"); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", "/fake/outer/boolean", "POST", new ArrayList<>(), body, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } /** * @@ -166,10 +165,11 @@ public OuterComposite fakeOuterCompositeSerialize(@jakarta.annotation.Nullable O public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(@jakarta.annotation.Nullable OuterComposite outerComposite) throws ApiException { String localVarAccept = apiClient.selectHeaderAccept("*/*"); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", "/fake/outer/composite", "POST", new ArrayList<>(), outerComposite, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } /** * @@ -204,10 +204,11 @@ public BigDecimal fakeOuterNumberSerialize(@jakarta.annotation.Nullable BigDecim public ApiResponse fakeOuterNumberSerializeWithHttpInfo(@jakarta.annotation.Nullable BigDecimal body) throws ApiException { String localVarAccept = apiClient.selectHeaderAccept("*/*"); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", "/fake/outer/number", "POST", new ArrayList<>(), body, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } /** * @@ -242,10 +243,11 @@ public String fakeOuterStringSerialize(@jakarta.annotation.Nullable String body) public ApiResponse fakeOuterStringSerializeWithHttpInfo(@jakarta.annotation.Nullable String body) throws ApiException { String localVarAccept = apiClient.selectHeaderAccept("*/*"); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", "/fake/outer/string", "POST", new ArrayList<>(), body, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } /** * Array of Enums @@ -278,10 +280,11 @@ public List getArrayOfEnums() throws ApiException { public ApiResponse> getArrayOfEnumsWithHttpInfo() throws ApiException { String localVarAccept = apiClient.selectHeaderAccept("application/json"); String localVarContentType = apiClient.selectHeaderContentType(); + final Map localVarErrorTypes = new HashMap(); GenericType> localVarReturnType = new GenericType>() {}; return apiClient.invokeAPI("FakeApi.getArrayOfEnums", "/fake/array-of-enums", "GET", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } /** * Array of string @@ -295,7 +298,7 @@ public ApiResponse> getArrayOfEnumsWithHttpInfo() throws ApiExce 200 ok - */ - public void postArrayOfString(@jakarta.annotation.Nullable List<@Pattern(regexp = "[A-Z0-9]+")String> requestBody) throws ApiException { + public void postArrayOfString(@jakarta.annotation.Nullable List requestBody) throws ApiException { postArrayOfStringWithHttpInfo(requestBody); } @@ -312,12 +315,13 @@ public void postArrayOfString(@jakarta.annotation.Nullable List<@Pattern(regexp 200 ok - */ - public ApiResponse postArrayOfStringWithHttpInfo(@jakarta.annotation.Nullable List<@Pattern(regexp = "[A-Z0-9]+")String> requestBody) throws ApiException { + public ApiResponse postArrayOfStringWithHttpInfo(@jakarta.annotation.Nullable List requestBody) throws ApiException { String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.postArrayOfString", "/fake/request-array-string", "POST", new ArrayList<>(), requestBody, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * test referenced additionalProperties @@ -356,9 +360,10 @@ public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(@jakarta. String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.testAdditionalPropertiesReference", "/fake/additionalProperties-reference", "POST", new ArrayList<>(), requestBody, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * @@ -397,9 +402,10 @@ public ApiResponse testBodyWithFileSchemaWithHttpInfo(@jakarta.annotation. String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", "/fake/body-with-file-schema", "PUT", new ArrayList<>(), fileSchemaTestClass, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * @@ -448,9 +454,10 @@ public ApiResponse testBodyWithQueryParamsWithHttpInfo(@jakarta.annotation String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", "/fake/body-with-query-params", "PUT", localVarQueryParams, user, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * To test \"client\" model @@ -490,10 +497,11 @@ public ApiResponse testClientModelWithHttpInfo(@jakarta.annotation.Nonnu String localVarAccept = apiClient.selectHeaderAccept("application/json"); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("FakeApi.testClientModel", "/fake", "PATCH", new ArrayList<>(), client, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } /** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -607,9 +615,10 @@ public ApiResponse testEndpointParametersWithHttpInfo(@jakarta.annotation. String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/x-www-form-urlencoded"); String[] localVarAuthNames = new String[] {"http_basic_test"}; + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.testEndpointParameters", "/fake", "POST", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, false); + localVarAuthNames, null, false, localVarErrorTypes); } /** * To test enum parameters @@ -685,9 +694,10 @@ public ApiResponse testEnumParametersWithHttpInfo(@jakarta.annotation.Null String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/x-www-form-urlencoded"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.testEnumParameters", "/fake", "GET", localVarQueryParams, null, localVarHeaderParams, new LinkedHashMap<>(), localVarFormParams, localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } private ApiResponse testGroupParametersWithHttpInfo(@jakarta.annotation.Nonnull Integer requiredStringGroup, @jakarta.annotation.Nonnull Boolean requiredBooleanGroup, @jakarta.annotation.Nonnull Long requiredInt64Group, @jakarta.annotation.Nullable Integer stringGroup, @jakarta.annotation.Nullable Boolean booleanGroup, @jakarta.annotation.Nullable Long int64Group) throws ApiException { @@ -720,9 +730,10 @@ private ApiResponse testGroupParametersWithHttpInfo(@jakarta.annotation.No String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType(); String[] localVarAuthNames = new String[] {"bearer_test"}; + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.testGroupParameters", "/fake", "DELETE", localVarQueryParams, null, localVarHeaderParams, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - localVarAuthNames, null, false); + localVarAuthNames, null, false, localVarErrorTypes); } public class APItestGroupParametersRequest { @@ -884,9 +895,10 @@ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(@jakarta.ann String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.testInlineAdditionalProperties", "/fake/inline-additionalProperties", "POST", new ArrayList<>(), requestBody, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * test inline free-form additionalProperties @@ -925,9 +937,10 @@ public ApiResponse testInlineFreeformAdditionalPropertiesWithHttpInfo(@jak String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.testInlineFreeformAdditionalProperties", "/fake/inline-freeform-additionalProperties", "POST", new ArrayList<>(), testInlineFreeformAdditionalPropertiesRequest, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * test json serialization of form data @@ -976,9 +989,10 @@ public ApiResponse testJsonFormDataWithHttpInfo(@jakarta.annotation.Nonnul String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/x-www-form-urlencoded"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.testJsonFormData", "/fake/jsonFormData", "GET", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarFormParams, localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * @@ -1046,9 +1060,10 @@ public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@jakarta String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType(); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.testQueryParameterCollectionFormat", "/fake/test-query-parameters", "PUT", localVarQueryParams, null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * test referenced string map @@ -1087,8 +1102,9 @@ public ApiResponse testStringMapReferenceWithHttpInfo(@jakarta.annotation. String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("FakeApi.testStringMapReference", "/fake/stringMap-reference", "POST", new ArrayList<>(), requestBody, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 215ee4d24166..2c42ca2ced74 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -10,9 +10,6 @@ import org.openapitools.client.model.Client; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; - import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -88,9 +85,10 @@ public ApiResponse testClassnameWithHttpInfo(@jakarta.annotation.Nonnull String localVarAccept = apiClient.selectHeaderAccept("application/json"); String localVarContentType = apiClient.selectHeaderContentType("application/json"); String[] localVarAuthNames = new String[] {"api_key_query"}; + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", "/fake_classname_test", "PATCH", new ArrayList<>(), client, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); + localVarAuthNames, localVarReturnType, false, localVarErrorTypes); } } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/PetApi.java index 21eea42ee48b..c5603bb9ef84 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/PetApi.java @@ -12,9 +12,6 @@ import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; - import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -89,9 +86,10 @@ public ApiResponse addPetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json", "application/xml"); String[] localVarAuthNames = new String[] {"petstore_auth", "http_signature_test"}; + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("PetApi.addPet", "/pet", "POST", new ArrayList<>(), pet, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - localVarAuthNames, null, false); + localVarAuthNames, null, false, localVarErrorTypes); } /** * Deletes a pet @@ -143,9 +141,10 @@ public ApiResponse deletePetWithHttpInfo(@jakarta.annotation.Nonnull Long String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType(); String[] localVarAuthNames = new String[] {"petstore_auth"}; + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", new ArrayList<>(), null, localVarHeaderParams, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - localVarAuthNames, null, false); + localVarAuthNames, null, false, localVarErrorTypes); } /** * Finds Pets by status @@ -193,10 +192,11 @@ public ApiResponse> findPetsByStatusWithHttpInfo(@jakarta.annotation.N String localVarAccept = apiClient.selectHeaderAccept("application/xml", "application/json"); String localVarContentType = apiClient.selectHeaderContentType(); String[] localVarAuthNames = new String[] {"petstore_auth", "http_signature_test"}; + final Map localVarErrorTypes = new HashMap(); GenericType> localVarReturnType = new GenericType>() {}; return apiClient.invokeAPI("PetApi.findPetsByStatus", "/pet/findByStatus", "GET", localVarQueryParams, null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); + localVarAuthNames, localVarReturnType, false, localVarErrorTypes); } /** * Finds Pets by tags @@ -248,10 +248,11 @@ public ApiResponse> findPetsByTagsWithHttpInfo(@jakarta.annotation.Non String localVarAccept = apiClient.selectHeaderAccept("application/xml", "application/json"); String localVarContentType = apiClient.selectHeaderContentType(); String[] localVarAuthNames = new String[] {"petstore_auth", "http_signature_test"}; + final Map localVarErrorTypes = new HashMap(); GenericType> localVarReturnType = new GenericType>() {}; return apiClient.invokeAPI("PetApi.findPetsByTags", "/pet/findByTags", "GET", localVarQueryParams, null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); + localVarAuthNames, localVarReturnType, false, localVarErrorTypes); } /** * Find pet by ID @@ -300,10 +301,11 @@ public ApiResponse getPetByIdWithHttpInfo(@jakarta.annotation.Nonnull Long String localVarAccept = apiClient.selectHeaderAccept("application/xml", "application/json"); String localVarContentType = apiClient.selectHeaderContentType(); String[] localVarAuthNames = new String[] {"api_key"}; + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); + localVarAuthNames, localVarReturnType, false, localVarErrorTypes); } /** * Update an existing pet @@ -347,9 +349,10 @@ public ApiResponse updatePetWithHttpInfo(@jakarta.annotation.Nonnull Pet p String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json", "application/xml"); String[] localVarAuthNames = new String[] {"petstore_auth", "http_signature_test"}; + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("PetApi.updatePet", "/pet", "PUT", new ArrayList<>(), pet, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - localVarAuthNames, null, false); + localVarAuthNames, null, false, localVarErrorTypes); } /** * Updates a pet in the store with form data @@ -406,9 +409,10 @@ public ApiResponse updatePetWithFormWithHttpInfo(@jakarta.annotation.Nonnu String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/x-www-form-urlencoded"); String[] localVarAuthNames = new String[] {"petstore_auth"}; + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, false); + localVarAuthNames, null, false, localVarErrorTypes); } /** * uploads an image @@ -466,10 +470,11 @@ public ApiResponse uploadFileWithHttpInfo(@jakarta.annotation. String localVarAccept = apiClient.selectHeaderAccept("application/json"); String localVarContentType = apiClient.selectHeaderContentType("multipart/form-data"); String[] localVarAuthNames = new String[] {"petstore_auth"}; + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); + localVarAuthNames, localVarReturnType, false, localVarErrorTypes); } /** * uploads an image (required) @@ -528,9 +533,10 @@ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@jak String localVarAccept = apiClient.selectHeaderAccept("application/json"); String localVarContentType = apiClient.selectHeaderContentType("multipart/form-data"); String[] localVarAuthNames = new String[] {"petstore_auth"}; + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); + localVarAuthNames, localVarReturnType, false, localVarErrorTypes); } } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/StoreApi.java index 696ee2619e0b..43c8f799fff8 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/StoreApi.java @@ -10,9 +10,6 @@ import org.openapitools.client.model.Order; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; - import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -92,9 +89,10 @@ public ApiResponse deleteOrderWithHttpInfo(@jakarta.annotation.Nonnull Str String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType(); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * Returns pet inventories by status @@ -128,10 +126,11 @@ public ApiResponse> getInventoryWithHttpInfo() throws ApiEx String localVarAccept = apiClient.selectHeaderAccept("application/json"); String localVarContentType = apiClient.selectHeaderContentType(); String[] localVarAuthNames = new String[] {"api_key"}; + final Map localVarErrorTypes = new HashMap(); GenericType> localVarReturnType = new GenericType>() {}; return apiClient.invokeAPI("StoreApi.getInventory", "/store/inventory", "GET", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, false); + localVarAuthNames, localVarReturnType, false, localVarErrorTypes); } /** * Find purchase order by ID @@ -179,10 +178,11 @@ public ApiResponse getOrderByIdWithHttpInfo(@jakarta.annotation.Nonnull L String localVarAccept = apiClient.selectHeaderAccept("application/xml", "application/json"); String localVarContentType = apiClient.selectHeaderContentType(); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } /** * Place an order for a pet @@ -224,9 +224,10 @@ public ApiResponse placeOrderWithHttpInfo(@jakarta.annotation.Nonnull Ord String localVarAccept = apiClient.selectHeaderAccept("application/xml", "application/json"); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("StoreApi.placeOrder", "/store/order", "POST", new ArrayList<>(), order, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/UserApi.java index e23d2cddac66..10cf03612f4c 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/UserApi.java @@ -11,9 +11,6 @@ import java.time.OffsetDateTime; import org.openapitools.client.model.User; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; - import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -87,9 +84,10 @@ public ApiResponse createUserWithHttpInfo(@jakarta.annotation.Nonnull User String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("UserApi.createUser", "/user", "POST", new ArrayList<>(), user, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * Creates list of users with given input array @@ -103,7 +101,7 @@ public ApiResponse createUserWithHttpInfo(@jakarta.annotation.Nonnull User 0 successful operation - */ - public void createUsersWithArrayInput(@jakarta.annotation.Nonnull List<@Valid User> user) throws ApiException { + public void createUsersWithArrayInput(@jakarta.annotation.Nonnull List user) throws ApiException { createUsersWithArrayInputWithHttpInfo(user); } @@ -120,7 +118,7 @@ public void createUsersWithArrayInput(@jakarta.annotation.Nonnull List<@Valid Us 0 successful operation - */ - public ApiResponse createUsersWithArrayInputWithHttpInfo(@jakarta.annotation.Nonnull List<@Valid User> user) throws ApiException { + public ApiResponse createUsersWithArrayInputWithHttpInfo(@jakarta.annotation.Nonnull List user) throws ApiException { // Check required parameters if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); @@ -128,9 +126,10 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(@jakarta.annotati String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", "/user/createWithArray", "POST", new ArrayList<>(), user, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * Creates list of users with given input array @@ -144,7 +143,7 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(@jakarta.annotati 0 successful operation - */ - public void createUsersWithListInput(@jakarta.annotation.Nonnull List<@Valid User> user) throws ApiException { + public void createUsersWithListInput(@jakarta.annotation.Nonnull List user) throws ApiException { createUsersWithListInputWithHttpInfo(user); } @@ -161,7 +160,7 @@ public void createUsersWithListInput(@jakarta.annotation.Nonnull List<@Valid Use 0 successful operation - */ - public ApiResponse createUsersWithListInputWithHttpInfo(@jakarta.annotation.Nonnull List<@Valid User> user) throws ApiException { + public ApiResponse createUsersWithListInputWithHttpInfo(@jakarta.annotation.Nonnull List user) throws ApiException { // Check required parameters if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); @@ -169,9 +168,10 @@ public ApiResponse createUsersWithListInputWithHttpInfo(@jakarta.annotatio String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("UserApi.createUsersWithListInput", "/user/createWithList", "POST", new ArrayList<>(), user, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * Delete user @@ -216,9 +216,10 @@ public ApiResponse deleteUserWithHttpInfo(@jakarta.annotation.Nonnull Stri String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType(); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * Get user by user name @@ -266,10 +267,11 @@ public ApiResponse getUserByNameWithHttpInfo(@jakarta.annotation.Nonnull S String localVarAccept = apiClient.selectHeaderAccept("application/xml", "application/json"); String localVarContentType = apiClient.selectHeaderContentType(); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } /** * Logs user into the system @@ -322,10 +324,11 @@ public ApiResponse loginUserWithHttpInfo(@jakarta.annotation.Nonnull Str String localVarAccept = apiClient.selectHeaderAccept("application/xml", "application/json"); String localVarContentType = apiClient.selectHeaderContentType(); + final Map localVarErrorTypes = new HashMap(); GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("UserApi.loginUser", "/user/login", "GET", localVarQueryParams, null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, localVarReturnType, false); + null, localVarReturnType, false, localVarErrorTypes); } /** * Logs out current logged in user session @@ -357,9 +360,10 @@ public void logoutUser() throws ApiException { public ApiResponse logoutUserWithHttpInfo() throws ApiException { String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType(); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("UserApi.logoutUser", "/user/logout", "GET", new ArrayList<>(), null, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } /** * Updated user @@ -409,8 +413,9 @@ public ApiResponse updateUserWithHttpInfo(@jakarta.annotation.Nonnull Stri String localVarAccept = apiClient.selectHeaderAccept(); String localVarContentType = apiClient.selectHeaderContentType("application/json"); + final Map localVarErrorTypes = new HashMap(); return apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", new ArrayList<>(), user, new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, - null, null, false); + null, null, false, localVarErrorTypes); } } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 8f963ffe984c..d2dda62fbca2 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -31,8 +29,6 @@ import org.openapitools.jackson.nullable.JsonNullable; import java.util.NoSuchElementException; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -103,7 +99,6 @@ public AdditionalPropertiesClass putMapPropertyItem(String key, String mapProper * @return mapProperty */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_MAP_PROPERTY, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -137,8 +132,6 @@ public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -348,7 +349,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(mapProperty, mapOfMapProperty, hashCodeNullable(anytype1), mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, emptyMap, mapWithUndeclaredPropertiesString); } private static int hashCodeNullable(JsonNullable a) { diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java index 06a183bab28a..2a1ae9517d3d 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -55,7 +51,6 @@ public AllOfRefToDouble height(@jakarta.annotation.Nullable Double height) { * @return height */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -76,12 +71,19 @@ public void setHeight(@jakarta.annotation.Nullable Double height) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfRefToDouble allOfRefToDouble = (AllOfRefToDouble) o; + return Objects.equals(this.height, allOfRefToDouble.height); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(height); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java index fcd09ee8fba7..409f4b9d48c2 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -55,7 +51,6 @@ public AllOfRefToFloat weight(@jakarta.annotation.Nullable Float weight) { * @return weight */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -76,12 +71,19 @@ public void setWeight(@jakarta.annotation.Nullable Float weight) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfRefToFloat allOfRefToFloat = (AllOfRefToFloat) o; + return Objects.equals(this.weight, allOfRefToFloat.weight); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(weight); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java index 49f3142993cc..d7867ce60bcf 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -55,7 +51,6 @@ public AllOfRefToLong id(@jakarta.annotation.Nullable Long id) { * @return id */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ID, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -76,12 +71,19 @@ public void setId(@jakarta.annotation.Nullable Long id) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfRefToLong allOfRefToLong = (AllOfRefToLong) o; + return Objects.equals(this.id, allOfRefToLong.id); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(id); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Animal.java index 4c5d8da8455b..ff46c6e1de27 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Animal.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -28,8 +26,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -73,8 +69,6 @@ public Animal className(@jakarta.annotation.Nonnull String className) { * @return className */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -100,7 +94,6 @@ public Animal color(@jakarta.annotation.Nullable String color) { * @return color */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -121,12 +114,20 @@ public void setColor(@jakarta.annotation.Nullable String color) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(className, color); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Apple.java index bde79bb52b47..4a5445b9932e 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Apple.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Apple.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -61,7 +57,6 @@ public Apple cultivar(@jakarta.annotation.Nullable String cultivar) { * @return cultivar */ @jakarta.annotation.Nullable - @Pattern(regexp="^[a-zA-Z\\s]*$") @JsonProperty(value = JSON_PROPERTY_CULTIVAR, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -87,7 +82,6 @@ public Apple origin(@jakarta.annotation.Nullable String origin) { * @return origin */ @jakarta.annotation.Nullable - @Pattern(regexp="/^[A-Z\\s]*$/i") @JsonProperty(value = JSON_PROPERTY_ORIGIN, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -108,12 +102,20 @@ public void setOrigin(@jakarta.annotation.Nullable String origin) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(cultivar, origin); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AppleReq.java index f93945bf4dd4..ba85e3fcefec 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AppleReq.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AppleReq.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -61,8 +57,6 @@ public AppleReq cultivar(@jakarta.annotation.Nonnull String cultivar) { * @return cultivar */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_CULTIVAR, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -88,7 +82,6 @@ public AppleReq mealy(@jakarta.annotation.Nullable Boolean mealy) { * @return mealy */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_MEALY, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -109,12 +102,20 @@ public void setMealy(@jakarta.annotation.Nullable Boolean mealy) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(cultivar, mealy); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index b0479da02655..08dffa4a12d1 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -28,8 +26,6 @@ import java.util.Arrays; import java.util.List; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -66,8 +62,6 @@ public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayAr * @return arrayArrayNumber */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_NUMBER, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -88,12 +82,19 @@ public void setArrayArrayNumber(@jakarta.annotation.Nullable List arrayNu */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(arrayNumber); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayTest.java index fdb5acbad989..c97ec69e0138 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -28,8 +26,6 @@ import java.util.List; import org.openapitools.client.model.ReadOnlyFirst; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -53,7 +49,7 @@ public class ArrayTest { public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; @jakarta.annotation.Nullable - private List> arrayArrayOfModel = new ArrayList<>(); + private List> arrayArrayOfModel = new ArrayList<>(); public ArrayTest() { } @@ -76,7 +72,6 @@ public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { * @return arrayOfString */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ARRAY_OF_STRING, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -110,8 +105,6 @@ public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) * @return arrayArrayOfInteger */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -127,12 +120,12 @@ public void setArrayArrayOfInteger(@jakarta.annotation.Nullable List> } - public ArrayTest arrayArrayOfModel(@jakarta.annotation.Nullable List> arrayArrayOfModel) { + public ArrayTest arrayArrayOfModel(@jakarta.annotation.Nullable List> arrayArrayOfModel) { this.arrayArrayOfModel = arrayArrayOfModel; return this; } - public ArrayTest addArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) { + public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { this.arrayArrayOfModel = new ArrayList<>(); } @@ -145,19 +138,17 @@ public ArrayTest addArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayO * @return arrayArrayOfModel */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List> getArrayArrayOfModel() { + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setArrayArrayOfModel(@jakarta.annotation.Nullable List> arrayArrayOfModel) { + public void setArrayArrayOfModel(@jakarta.annotation.Nullable List> arrayArrayOfModel) { this.arrayArrayOfModel = arrayArrayOfModel; } @@ -167,12 +158,21 @@ public void setArrayArrayOfModel(@jakarta.annotation.Nullable List additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public Cat putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 Cat object is equal to o. */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(declawed, super.hashCode()); } @Override @@ -142,7 +104,6 @@ public String toString() { sb.append("class Cat {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Category.java index 421d03b37a66..a5ae86785d81 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Category.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -60,7 +56,6 @@ public Category id(@jakarta.annotation.Nullable Long id) { * @return id */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ID, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -86,8 +81,6 @@ public Category name(@jakarta.annotation.Nonnull String name) { * @return name */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_NAME, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -108,12 +101,20 @@ public void setName(@jakarta.annotation.Nonnull String name) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(id, name); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ChildCat.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ChildCat.java index 2fa67b9ecbc7..8eed54f4bf96 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ChildCat.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ChildCat.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -35,8 +29,6 @@ import java.util.Set; import java.util.HashSet; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -76,7 +68,6 @@ public ChildCat name(@jakarta.annotation.Nullable String name) { * @return name */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_NAME, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -110,7 +101,6 @@ public ChildCat petType(@jakarta.annotation.Nullable String petType) { * @return petType */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_PET_TYPE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -129,55 +119,27 @@ public void setPetType(@jakarta.annotation.Nullable String petType) { this.petType = petType; } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public ChildCat putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 ChildCat object is equal to o. */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(name, petType, super.hashCode()); } @Override @@ -187,7 +149,6 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ClassModel.java index bc166beabb59..8693a5882be2 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ClassModel.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -55,7 +51,6 @@ public ClassModel propertyClass(@jakarta.annotation.Nullable String propertyClas * @return propertyClass */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_PROPERTY_CLASS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -76,12 +71,19 @@ public void setPropertyClass(@jakarta.annotation.Nullable String propertyClass) */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(propertyClass); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Client.java index 236f860787a3..bdfb834d467c 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Client.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -55,7 +51,6 @@ public Client client(@jakarta.annotation.Nullable String client) { * @return client */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_CLIENT, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -76,12 +71,19 @@ public void setClient(@jakarta.annotation.Nullable String client) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(client); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java index dcb9e8af81c0..6b5a00ae4eb4 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -29,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -64,8 +56,6 @@ public ComplexQuadrilateral shapeType(@jakarta.annotation.Nonnull String shapeTy * @return shapeType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -91,8 +81,6 @@ public ComplexQuadrilateral quadrilateralType(@jakarta.annotation.Nonnull String * @return quadrilateralType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -107,55 +95,26 @@ public void setQuadrilateralType(@jakarta.annotation.Nonnull String quadrilatera this.quadrilateralType = quadrilateralType; } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public ComplexQuadrilateral putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 ComplexQuadrilateral object is equal to o. */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(shapeType, quadrilateralType); } @Override @@ -164,7 +123,6 @@ public String toString() { sb.append("class ComplexQuadrilateral {\n"); sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DanishPig.java index dcfe14c45d0e..c1e02bbba79a 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DanishPig.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DanishPig.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -55,8 +51,6 @@ public DanishPig className(@jakarta.annotation.Nonnull String className) { * @return className */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -77,12 +71,19 @@ public void setClassName(@jakarta.annotation.Nonnull String className) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(className); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DeprecatedObject.java index 0b27bb0ee5ed..6201aa7056ba 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DeprecatedObject.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -57,7 +53,6 @@ public DeprecatedObject name(@jakarta.annotation.Nullable String name) { * @return name */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_NAME, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -78,12 +73,19 @@ public void setName(@jakarta.annotation.Nullable String name) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeprecatedObject deprecatedObject = (DeprecatedObject) o; + return Objects.equals(this.name, deprecatedObject.name); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(name); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Dog.java index c03044cca8cc..5b8083f36212 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Dog.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -33,8 +27,6 @@ import java.util.Arrays; import org.openapitools.client.model.Animal; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -69,7 +61,6 @@ public Dog breed(@jakarta.annotation.Nullable String breed) { * @return breed */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_BREED, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -84,55 +75,26 @@ public void setBreed(@jakarta.annotation.Nullable String breed) { this.breed = breed; } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public Dog putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 Dog object is equal to o. */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(breed, super.hashCode()); } @Override @@ -141,7 +103,6 @@ public String toString() { sb.append("class Dog {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Drawing.java index 9ef7f0fa4116..7bb91d138adf 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Drawing.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Drawing.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonAnyGetter; @@ -39,8 +37,6 @@ import org.openapitools.jackson.nullable.JsonNullable; import java.util.NoSuchElementException; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -82,8 +78,6 @@ public Drawing mainShape(@jakarta.annotation.Nullable Shape mainShape) { * @return mainShape */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_MAIN_SHAPE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -109,8 +103,6 @@ public Drawing shapeOrNull(@jakarta.annotation.Nullable ShapeOrNull shapeOrNull) * @return shapeOrNull */ @jakarta.annotation.Nullable - @Valid - @JsonIgnore public ShapeOrNull getShapeOrNull() { @@ -144,8 +136,6 @@ public Drawing nullableShape(@jakarta.annotation.Nullable NullableShape nullable * @return nullableShape */ @jakarta.annotation.Nullable - @Valid - @JsonIgnore public NullableShape getNullableShape() { @@ -187,8 +177,6 @@ public Drawing addShapesItem(Shape shapesItem) { * @return shapes */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_SHAPES, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -246,7 +234,18 @@ public Fruit getAdditionalProperty(String key) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Drawing drawing = (Drawing) o; + return Objects.equals(this.mainShape, drawing.mainShape) && + equalsNullable(this.shapeOrNull, drawing.shapeOrNull) && + equalsNullable(this.nullableShape, drawing.nullableShape) && + Objects.equals(this.shapes, drawing.shapes)&& + Objects.equals(this.additionalProperties, drawing.additionalProperties); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -255,7 +254,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(mainShape, hashCodeNullable(shapeOrNull), hashCodeNullable(nullableShape), shapes, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumArrays.java index 72f8efccb8dd..4d5dca83868f 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -27,8 +25,6 @@ import java.util.Arrays; import java.util.List; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -132,7 +128,6 @@ public EnumArrays justSymbol(@jakarta.annotation.Nullable JustSymbolEnum justSym * @return justSymbol */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_JUST_SYMBOL, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -166,7 +161,6 @@ public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { * @return arrayEnum */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ARRAY_ENUM, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -187,12 +181,20 @@ public void setArrayEnum(@jakarta.annotation.Nullable List arrayE */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(justSymbol, arrayEnum); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumClass.java index a8d97ff8d03d..0150ebe31b41 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumClass.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumClass.java @@ -13,14 +13,10 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumTest.java index fcc40c915885..509c9f5481a3 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EnumTest.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -33,8 +31,6 @@ import org.openapitools.jackson.nullable.JsonNullable; import java.util.NoSuchElementException; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -282,7 +278,6 @@ public EnumTest enumString(@jakarta.annotation.Nullable EnumStringEnum enumStrin * @return enumString */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ENUM_STRING, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -308,8 +303,6 @@ public EnumTest enumStringRequired(@jakarta.annotation.Nonnull EnumStringRequire * @return enumStringRequired */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_ENUM_STRING_REQUIRED, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -335,7 +328,6 @@ public EnumTest enumInteger(@jakarta.annotation.Nullable EnumIntegerEnum enumInt * @return enumInteger */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ENUM_INTEGER, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -361,7 +353,6 @@ public EnumTest enumIntegerOnly(@jakarta.annotation.Nullable EnumIntegerOnlyEnum * @return enumIntegerOnly */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ENUM_INTEGER_ONLY, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -387,7 +378,6 @@ public EnumTest enumNumber(@jakarta.annotation.Nullable EnumNumberEnum enumNumbe * @return enumNumber */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ENUM_NUMBER, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -413,8 +403,6 @@ public EnumTest outerEnum(@jakarta.annotation.Nullable OuterEnum outerEnum) { * @return outerEnum */ @jakarta.annotation.Nullable - @Valid - @JsonIgnore public OuterEnum getOuterEnum() { @@ -448,8 +436,6 @@ public EnumTest outerEnumInteger(@jakarta.annotation.Nullable OuterEnumInteger o * @return outerEnumInteger */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_INTEGER, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -475,8 +461,6 @@ public EnumTest outerEnumDefaultValue(@jakarta.annotation.Nullable OuterEnumDefa * @return outerEnumDefaultValue */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -502,8 +486,6 @@ public EnumTest outerEnumIntegerDefaultValue(@jakarta.annotation.Nullable OuterE * @return outerEnumIntegerDefaultValue */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -524,7 +506,22 @@ public void setOuterEnumIntegerDefaultValue(@jakarta.annotation.Nullable OuterEn */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + 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) && + Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) && + Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -533,7 +530,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumIntegerOnly, enumNumber, hashCodeNullable(outerEnum), outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); } private static int hashCodeNullable(JsonNullable a) { diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java index 597609111f84..662ade9ad613 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -29,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -64,8 +56,6 @@ public EquilateralTriangle shapeType(@jakarta.annotation.Nonnull String shapeTyp * @return shapeType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -91,8 +81,6 @@ public EquilateralTriangle triangleType(@jakarta.annotation.Nonnull String trian * @return triangleType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -107,55 +95,26 @@ public void setTriangleType(@jakarta.annotation.Nonnull String triangleType) { this.triangleType = triangleType; } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public EquilateralTriangle putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 EquilateralTriangle object is equal to o. */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(shapeType, triangleType); } @Override @@ -164,7 +123,6 @@ public String toString() { sb.append("class EquilateralTriangle {\n"); sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); sb.append(" triangleType: ").append(toIndentedString(triangleType)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index a67cdded729a..579b4efa21ed 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -28,8 +26,6 @@ import java.util.List; import org.openapitools.client.model.ModelFile; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -48,7 +44,7 @@ public class FileSchemaTestClass { public static final String JSON_PROPERTY_FILES = "files"; @jakarta.annotation.Nullable - private List<@Valid ModelFile> files = new ArrayList<>(); + private List files = new ArrayList<>(); public FileSchemaTestClass() { } @@ -63,8 +59,6 @@ public FileSchemaTestClass _file(@jakarta.annotation.Nullable ModelFile _file) { * @return _file */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_FILE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -80,7 +74,7 @@ public void setFile(@jakarta.annotation.Nullable ModelFile _file) { } - public FileSchemaTestClass files(@jakarta.annotation.Nullable List<@Valid ModelFile> files) { + public FileSchemaTestClass files(@jakarta.annotation.Nullable List files) { this.files = files; return this; } @@ -98,19 +92,17 @@ public FileSchemaTestClass addFilesItem(ModelFile filesItem) { * @return files */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_FILES, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List<@Valid ModelFile> getFiles() { + public List getFiles() { return files; } @JsonProperty(value = JSON_PROPERTY_FILES, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFiles(@jakarta.annotation.Nullable List<@Valid ModelFile> files) { + public void setFiles(@jakarta.annotation.Nullable List files) { this.files = files; } @@ -120,12 +112,20 @@ public void setFiles(@jakarta.annotation.Nullable List<@Valid ModelFile> files) */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this._file, fileSchemaTestClass._file) && + Objects.equals(this.files, fileSchemaTestClass.files); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(_file, files); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Foo.java index aa2b92e4e805..f3fc062a1da9 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Foo.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -55,7 +51,6 @@ public Foo bar(@jakarta.annotation.Nullable String bar) { * @return bar */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_BAR, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -76,12 +71,19 @@ public void setBar(@jakarta.annotation.Nullable String bar) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Foo foo = (Foo) o; + return Objects.equals(this.bar, foo.bar); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(bar); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java index c490fde0486e..e216f393a4e9 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -26,8 +24,6 @@ import java.util.Arrays; import org.openapitools.client.model.Foo; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -57,8 +53,6 @@ public FooGetDefaultResponse string(@jakarta.annotation.Nullable Foo string) { * @return string */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_STRING, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -79,12 +73,19 @@ public void setString(@jakarta.annotation.Nullable Foo string) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(string); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FormatTest.java index 90fea3fd5cdf..6dbf825a882e 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FormatTest.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -30,8 +28,6 @@ import java.util.Arrays; import java.util.UUID; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -138,7 +134,6 @@ public FormatTest integer(@jakarta.annotation.Nullable Integer integer) { * @return integer */ @jakarta.annotation.Nullable - @Min(10) @Max(100) @JsonProperty(value = JSON_PROPERTY_INTEGER, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -166,7 +161,6 @@ public FormatTest int32(@jakarta.annotation.Nullable Integer int32) { * @return int32 */ @jakarta.annotation.Nullable - @Min(20) @Max(200) @JsonProperty(value = JSON_PROPERTY_INT32, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -192,7 +186,6 @@ public FormatTest int64(@jakarta.annotation.Nullable Long int64) { * @return int64 */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_INT64, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -220,9 +213,6 @@ public FormatTest number(@jakarta.annotation.Nonnull BigDecimal number) { * @return number */ @jakarta.annotation.Nonnull - @NotNull - @Valid - @DecimalMin("32.1") @DecimalMax("543.2") @JsonProperty(value = JSON_PROPERTY_NUMBER, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -250,7 +240,6 @@ public FormatTest _float(@jakarta.annotation.Nullable Float _float) { * @return _float */ @jakarta.annotation.Nullable - @DecimalMin("54.3") @DecimalMax("987.6") @JsonProperty(value = JSON_PROPERTY_FLOAT, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -278,7 +267,6 @@ public FormatTest _double(@jakarta.annotation.Nullable Double _double) { * @return _double */ @jakarta.annotation.Nullable - @DecimalMin("67.8") @DecimalMax("123.4") @JsonProperty(value = JSON_PROPERTY_DOUBLE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -304,8 +292,6 @@ public FormatTest decimal(@jakarta.annotation.Nullable BigDecimal decimal) { * @return decimal */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_DECIMAL, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -331,7 +317,6 @@ public FormatTest string(@jakarta.annotation.Nullable String string) { * @return string */ @jakarta.annotation.Nullable - @Pattern(regexp="/[a-z]/i") @JsonProperty(value = JSON_PROPERTY_STRING, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -357,8 +342,6 @@ public FormatTest _byte(@jakarta.annotation.Nonnull byte[] _byte) { * @return _byte */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_BYTE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -384,8 +367,6 @@ public FormatTest binary(@jakarta.annotation.Nullable File binary) { * @return binary */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_BINARY, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -411,9 +392,6 @@ public FormatTest date(@jakarta.annotation.Nonnull LocalDate date) { * @return date */ @jakarta.annotation.Nonnull - @NotNull - @Valid - @JsonProperty(value = JSON_PROPERTY_DATE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -439,8 +417,6 @@ public FormatTest dateTime(@jakarta.annotation.Nullable OffsetDateTime dateTime) * @return dateTime */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_DATE_TIME, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -466,8 +442,6 @@ public FormatTest uuid(@jakarta.annotation.Nullable UUID uuid) { * @return uuid */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_UUID, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -493,8 +467,6 @@ public FormatTest password(@jakarta.annotation.Nonnull String password) { * @return password */ @jakarta.annotation.Nonnull - @NotNull - @Size(min=10,max=64) @JsonProperty(value = JSON_PROPERTY_PASSWORD, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -520,7 +492,6 @@ public FormatTest patternWithDigits(@jakarta.annotation.Nullable String patternW * @return patternWithDigits */ @jakarta.annotation.Nullable - @Pattern(regexp="^\\d{10}$") @JsonProperty(value = JSON_PROPERTY_PATTERN_WITH_DIGITS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -546,7 +517,6 @@ public FormatTest patternWithDigitsAndDelimiter(@jakarta.annotation.Nullable Str * @return patternWithDigitsAndDelimiter */ @jakarta.annotation.Nullable - @Pattern(regexp="/^image_\\d{1,3}$/i") @JsonProperty(value = JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -567,12 +537,34 @@ public void setPatternWithDigitsAndDelimiter(@jakarta.annotation.Nullable String */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.decimal, formatTest.decimal) && + Objects.equals(this.string, formatTest.string) && + Arrays.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password) && + Objects.equals(this.patternWithDigits, formatTest.patternWithDigits) && + Objects.equals(this.patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(integer, int32, int64, number, _float, _double, decimal, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Fruit.java index c8849fe3a11f..3bf4681b7c3b 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Fruit.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Fruit.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -28,8 +26,6 @@ import org.openapitools.client.model.Apple; import org.openapitools.client.model.Banana; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; import com.fasterxml.jackson.core.type.TypeReference; diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FruitReq.java index fdea804b7b23..c7b5a4f590da 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FruitReq.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FruitReq.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -28,8 +26,6 @@ import org.openapitools.client.model.AppleReq; import org.openapitools.client.model.BananaReq; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; import com.fasterxml.jackson.core.type.TypeReference; diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GmFruit.java index 93954725a450..c6567bd814d7 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GmFruit.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GmFruit.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -28,8 +26,6 @@ import org.openapitools.client.model.Apple; import org.openapitools.client.model.Banana; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java index bb272cde7d6e..b221d2acb7ca 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -28,8 +26,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -68,8 +64,6 @@ public GrandparentAnimal petType(@jakarta.annotation.Nonnull String petType) { * @return petType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_PET_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -90,12 +84,19 @@ public void setPetType(@jakarta.annotation.Nonnull String petType) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(petType); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 65d4a06592c9..391848b281b4 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -66,7 +62,6 @@ public HasOnlyReadOnly( * @return bar */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_BAR, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -82,7 +77,6 @@ public String getBar() { * @return foo */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_FOO, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -98,12 +92,20 @@ public String getFoo() { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(bar, foo); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HealthCheckResult.java index d03284e7a21e..db1ea005cbb2 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -29,8 +27,6 @@ import org.openapitools.jackson.nullable.JsonNullable; import java.util.NoSuchElementException; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -58,7 +54,6 @@ public HealthCheckResult nullableMessage(@jakarta.annotation.Nullable String nul * @return nullableMessage */ @jakarta.annotation.Nullable - @JsonIgnore public String getNullableMessage() { @@ -87,7 +82,14 @@ public void setNullableMessage(@jakarta.annotation.Nullable String nullableMessa */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return equalsNullable(this.nullableMessage, healthCheckResult.nullableMessage); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -96,7 +98,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(hashCodeNullable(nullableMessage)); } private static int hashCodeNullable(JsonNullable a) { diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java index 571e606d968b..fa712f06f261 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -60,8 +56,6 @@ public IsoscelesTriangle shapeType(@jakarta.annotation.Nonnull String shapeType) * @return shapeType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -87,8 +81,6 @@ public IsoscelesTriangle triangleType(@jakarta.annotation.Nonnull String triangl * @return triangleType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -109,12 +101,20 @@ public void setTriangleType(@jakarta.annotation.Nonnull String triangleType) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(shapeType, triangleType); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Mammal.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Mammal.java index 25de7885e9b3..07f6206606d4 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Mammal.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Mammal.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -35,8 +29,6 @@ import org.openapitools.client.model.Whale; import org.openapitools.client.model.Zebra; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; import com.fasterxml.jackson.core.type.TypeReference; @@ -100,26 +92,6 @@ public MammalDeserializer(Class vc) { public Mammal deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode tree = ctxt.readTree(jp); Object deserialized = null; - Mammal newMammal = new Mammal(); - Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String)result2.get("className"); - switch (discriminatorValue) { - case "Pig": - deserialized = tree.traverse(jp.getCodec()).readValueAs(Pig.class); - newMammal.setActualInstance(deserialized); - return newMammal; - case "whale": - deserialized = tree.traverse(jp.getCodec()).readValueAs(Whale.class); - newMammal.setActualInstance(deserialized); - return newMammal; - case "zebra": - deserialized = tree.traverse(jp.getCodec()).readValueAs(Zebra.class); - newMammal.setActualInstance(deserialized); - return newMammal; - default: - log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Mammal. Possible values: Pig whale zebra", discriminatorValue)); - } - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); @@ -194,56 +166,7 @@ public Mammal getNullValue(DeserializationContext ctxt) throws JsonMappingExcept public Mammal() { super("oneOf", Boolean.FALSE); } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public Mammal putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 mammal object is equal to o. - */ - @Override - public boolean equals(Object o) { - return super.equals(o) && Objects.equals(this.additionalProperties, ((Mammal)o).additionalProperties); - } - @Override - public int hashCode() { - return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); - } public Mammal(Whale o) { super("oneOf", Boolean.FALSE); setActualInstance(o); diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MammalAnyof.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MammalAnyof.java index f65a02a0ed03..e97298aa75bb 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MammalAnyof.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MammalAnyof.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -35,8 +29,6 @@ import org.openapitools.client.model.Whale; import org.openapitools.client.model.Zebra; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -159,56 +151,7 @@ public MammalAnyof getNullValue(DeserializationContext ctxt) throws JsonMappingE public MammalAnyof() { super("anyOf", Boolean.FALSE); } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public MammalAnyof putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 mammal_anyof object is equal to o. - */ - @Override - public boolean equals(Object o) { - return super.equals(o) && Objects.equals(this.additionalProperties, ((MammalAnyof)o).additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); - } public MammalAnyof(Whale o) { super("anyOf", Boolean.FALSE); setActualInstance(o); diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MapTest.java index 2b24222db2e9..dfb9497f0353 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MapTest.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -27,8 +25,6 @@ import java.util.HashMap; import java.util.Map; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -115,8 +111,6 @@ public MapTest putMapMapOfStringItem(String key, Map mapMapOfStr * @return mapMapOfString */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_MAP_MAP_OF_STRING, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -150,7 +144,6 @@ public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) * @return mapOfEnumString */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_MAP_OF_ENUM_STRING, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -184,7 +177,6 @@ public MapTest putDirectMapItem(String key, Boolean directMapItem) { * @return directMap */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_DIRECT_MAP, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -218,7 +210,6 @@ public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { * @return indirectMap */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_INDIRECT_MAP, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -239,12 +230,22 @@ public void setIndirectMap(@jakarta.annotation.Nullable Map ind */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 8565aa43bdf5..719ca8e7ef3a 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -30,8 +28,6 @@ import java.util.UUID; import org.openapitools.client.model.Animal; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -70,8 +66,6 @@ public MixedPropertiesAndAdditionalPropertiesClass uuid(@jakarta.annotation.Null * @return uuid */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_UUID, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -97,8 +91,6 @@ public MixedPropertiesAndAdditionalPropertiesClass dateTime(@jakarta.annotation. * @return dateTime */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_DATE_TIME, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -132,8 +124,6 @@ public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal * @return map */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_MAP, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -154,12 +144,21 @@ public void setMap(@jakarta.annotation.Nullable Map map) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(uuid, dateTime, map); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Model200Response.java index 21f893609303..4aa9b96ddb19 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Model200Response.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -61,7 +57,6 @@ public Model200Response name(@jakarta.annotation.Nullable Integer name) { * @return name */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_NAME, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -87,7 +82,6 @@ public Model200Response propertyClass(@jakarta.annotation.Nullable String proper * @return propertyClass */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_PROPERTY_CLASS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -108,12 +102,20 @@ public void setPropertyClass(@jakarta.annotation.Nullable String propertyClass) */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(name, propertyClass); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelApiResponse.java index dc90edbd32a3..13d502025a50 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -66,7 +62,6 @@ public ModelApiResponse code(@jakarta.annotation.Nullable Integer code) { * @return code */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_CODE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -92,7 +87,6 @@ public ModelApiResponse type(@jakarta.annotation.Nullable String type) { * @return type */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -118,7 +112,6 @@ public ModelApiResponse message(@jakarta.annotation.Nullable String message) { * @return message */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_MESSAGE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -139,12 +132,21 @@ public void setMessage(@jakarta.annotation.Nullable String message) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(code, type, message); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelFile.java index 8d72f2cea260..cfd98539ff7b 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelFile.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -56,7 +52,6 @@ public ModelFile sourceURI(@jakarta.annotation.Nullable String sourceURI) { * @return sourceURI */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_SOURCE_U_R_I, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -77,12 +72,19 @@ public void setSourceURI(@jakarta.annotation.Nullable String sourceURI) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelFile _file = (ModelFile) o; + return Objects.equals(this.sourceURI, _file.sourceURI); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(sourceURI); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelList.java index 3548ff1c07eb..e3e79bdacdad 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelList.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -56,7 +52,6 @@ public ModelList _123list(@jakarta.annotation.Nullable String _123list) { * @return _123list */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_123LIST, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -77,12 +72,19 @@ public void set123list(@jakarta.annotation.Nullable String _123list) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelList _list = (ModelList) o; + return Objects.equals(this._123list, _list._123list); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(_123list); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelReturn.java index 4ad10dc0a037..2c074bd3a0b0 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -56,7 +52,6 @@ public ModelReturn _return(@jakarta.annotation.Nullable Integer _return) { * @return _return */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_RETURN, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -77,12 +72,19 @@ public void setReturn(@jakarta.annotation.Nullable Integer _return) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(_return); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Name.java index e70b16384063..cc1f0253f8ea 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Name.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -80,8 +76,6 @@ public Name name(@jakarta.annotation.Nonnull Integer name) { * @return name */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_NAME, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -102,7 +96,6 @@ public void setName(@jakarta.annotation.Nonnull Integer name) { * @return snakeCase */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_SNAKE_CASE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -123,7 +116,6 @@ public Name property(@jakarta.annotation.Nullable String property) { * @return property */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_PROPERTY, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -144,7 +136,6 @@ public void setProperty(@jakarta.annotation.Nullable String property) { * @return _123number */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_123NUMBER, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -160,12 +151,22 @@ public Integer get123number() { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(name, snakeCase, property, _123number); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableClass.java index 60cb4a0740be..dc8b80a2a03c 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableClass.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonAnyGetter; @@ -40,8 +38,6 @@ import org.openapitools.jackson.nullable.JsonNullable; import java.util.NoSuchElementException; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -115,7 +111,6 @@ public NullableClass integerProp(@jakarta.annotation.Nullable Integer integerPro * @return integerProp */ @jakarta.annotation.Nullable - @JsonIgnore public Integer getIntegerProp() { @@ -149,8 +144,6 @@ public NullableClass numberProp(@jakarta.annotation.Nullable BigDecimal numberPr * @return numberProp */ @jakarta.annotation.Nullable - @Valid - @JsonIgnore public BigDecimal getNumberProp() { @@ -184,7 +177,6 @@ public NullableClass booleanProp(@jakarta.annotation.Nullable Boolean booleanPro * @return booleanProp */ @jakarta.annotation.Nullable - @JsonIgnore public Boolean getBooleanProp() { @@ -218,7 +210,6 @@ public NullableClass stringProp(@jakarta.annotation.Nullable String stringProp) * @return stringProp */ @jakarta.annotation.Nullable - @JsonIgnore public String getStringProp() { @@ -252,8 +243,6 @@ public NullableClass dateProp(@jakarta.annotation.Nullable LocalDate dateProp) { * @return dateProp */ @jakarta.annotation.Nullable - @Valid - @JsonIgnore public LocalDate getDateProp() { @@ -287,8 +276,6 @@ public NullableClass datetimeProp(@jakarta.annotation.Nullable OffsetDateTime da * @return datetimeProp */ @jakarta.annotation.Nullable - @Valid - @JsonIgnore public OffsetDateTime getDatetimeProp() { @@ -334,7 +321,6 @@ public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { * @return arrayNullableProp */ @jakarta.annotation.Nullable - @JsonIgnore public List getArrayNullableProp() { @@ -380,7 +366,6 @@ public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullab * @return arrayAndItemsNullableProp */ @jakarta.annotation.Nullable - @JsonIgnore public List getArrayAndItemsNullableProp() { @@ -422,7 +407,6 @@ public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { * @return arrayItemsNullable */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -460,7 +444,6 @@ public NullableClass putObjectNullablePropItem(String key, Object objectNullable * @return objectNullableProp */ @jakarta.annotation.Nullable - @JsonIgnore public Map getObjectNullableProp() { @@ -506,7 +489,6 @@ public NullableClass putObjectAndItemsNullablePropItem(String key, Object object * @return objectAndItemsNullableProp */ @jakarta.annotation.Nullable - @JsonIgnore public Map getObjectAndItemsNullableProp() { @@ -548,7 +530,6 @@ public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNu * @return objectItemsNullable */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_OBJECT_ITEMS_NULLABLE, required = false) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) @@ -606,7 +587,26 @@ public Object getAdditionalProperty(String key) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableClass nullableClass = (NullableClass) o; + return equalsNullable(this.integerProp, nullableClass.integerProp) && + equalsNullable(this.numberProp, nullableClass.numberProp) && + equalsNullable(this.booleanProp, nullableClass.booleanProp) && + equalsNullable(this.stringProp, nullableClass.stringProp) && + equalsNullable(this.dateProp, nullableClass.dateProp) && + equalsNullable(this.datetimeProp, nullableClass.datetimeProp) && + equalsNullable(this.arrayNullableProp, nullableClass.arrayNullableProp) && + equalsNullable(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) && + Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) && + equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) && + equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && + Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable)&& + Objects.equals(this.additionalProperties, nullableClass.additionalProperties); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -615,7 +615,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableShape.java index f37075699d82..3a76d17e8872 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableShape.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableShape.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -34,8 +28,6 @@ import org.openapitools.client.model.Quadrilateral; import org.openapitools.client.model.Triangle; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; import com.fasterxml.jackson.core.type.TypeReference; @@ -99,22 +91,6 @@ public NullableShapeDeserializer(Class vc) { public NullableShape deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode tree = ctxt.readTree(jp); Object deserialized = null; - NullableShape newNullableShape = new NullableShape(); - Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String)result2.get("shapeType"); - switch (discriminatorValue) { - case "Quadrilateral": - deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); - newNullableShape.setActualInstance(deserialized); - return newNullableShape; - case "Triangle": - deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); - newNullableShape.setActualInstance(deserialized); - return newNullableShape; - default: - log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for NullableShape. Possible values: Quadrilateral Triangle", discriminatorValue)); - } - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); @@ -173,56 +149,7 @@ public NullableShape getNullValue(DeserializationContext ctxt) throws JsonMappin public NullableShape() { super("oneOf", Boolean.TRUE); } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public NullableShape putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 NullableShape object is equal to o. - */ - @Override - public boolean equals(Object o) { - return super.equals(o) && Objects.equals(this.additionalProperties, ((NullableShape)o).additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); - } public NullableShape(Triangle o) { super("oneOf", Boolean.FALSE); setActualInstance(o); diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NumberOnly.java index 366223248587..2f00a1bdf036 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -26,8 +24,6 @@ import java.math.BigDecimal; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -56,8 +52,6 @@ public NumberOnly justNumber(@jakarta.annotation.Nullable BigDecimal justNumber) * @return justNumber */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_JUST_NUMBER, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -78,12 +72,19 @@ public void setJustNumber(@jakarta.annotation.Nullable BigDecimal justNumber) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(justNumber); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index a999ac4fd377..0494242b4b5d 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -29,8 +27,6 @@ import java.util.List; import org.openapitools.client.model.DeprecatedObject; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -77,7 +73,6 @@ public ObjectWithDeprecatedFields uuid(@jakarta.annotation.Nullable String uuid) * @return uuid */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_UUID, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -106,8 +101,6 @@ public ObjectWithDeprecatedFields id(@jakarta.annotation.Nullable BigDecimal id) */ @Deprecated @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_ID, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -137,8 +130,6 @@ public ObjectWithDeprecatedFields deprecatedRef(@jakarta.annotation.Nullable Dep */ @Deprecated @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_DEPRECATED_REF, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -176,7 +167,6 @@ public ObjectWithDeprecatedFields addBarsItem(String barsItem) { */ @Deprecated @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_BARS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -198,12 +188,22 @@ public void setBars(@jakarta.annotation.Nullable List bars) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObjectWithDeprecatedFields objectWithDeprecatedFields = (ObjectWithDeprecatedFields) o; + return Objects.equals(this.uuid, objectWithDeprecatedFields.uuid) && + Objects.equals(this.id, objectWithDeprecatedFields.id) && + Objects.equals(this.deprecatedRef, objectWithDeprecatedFields.deprecatedRef) && + Objects.equals(this.bars, objectWithDeprecatedFields.bars); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(uuid, id, deprecatedRef, bars); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Order.java index 1a8521382d8b..628154f7ef8f 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Order.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -26,8 +24,6 @@ import java.time.OffsetDateTime; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -118,7 +114,6 @@ public Order id(@jakarta.annotation.Nullable Long id) { * @return id */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ID, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -144,7 +139,6 @@ public Order petId(@jakarta.annotation.Nullable Long petId) { * @return petId */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_PET_ID, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -170,7 +164,6 @@ public Order quantity(@jakarta.annotation.Nullable Integer quantity) { * @return quantity */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_QUANTITY, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -196,8 +189,6 @@ public Order shipDate(@jakarta.annotation.Nullable OffsetDateTime shipDate) { * @return shipDate */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_SHIP_DATE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -223,7 +214,6 @@ public Order status(@jakarta.annotation.Nullable StatusEnum status) { * @return status */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -249,7 +239,6 @@ public Order complete(@jakarta.annotation.Nullable Boolean complete) { * @return complete */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_COMPLETE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -270,12 +259,24 @@ public void setComplete(@jakarta.annotation.Nullable Boolean complete) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(id, petId, quantity, shipDate, status, complete); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterComposite.java index abbab8cdc38d..fda5badcecb7 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -26,8 +24,6 @@ import java.math.BigDecimal; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -66,8 +62,6 @@ public OuterComposite myNumber(@jakarta.annotation.Nullable BigDecimal myNumber) * @return myNumber */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_MY_NUMBER, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -93,7 +87,6 @@ public OuterComposite myString(@jakarta.annotation.Nullable String myString) { * @return myString */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_MY_STRING, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -119,7 +112,6 @@ public OuterComposite myBoolean(@jakarta.annotation.Nullable Boolean myBoolean) * @return myBoolean */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_MY_BOOLEAN, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -140,12 +132,21 @@ public void setMyBoolean(@jakarta.annotation.Nullable Boolean myBoolean) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(myNumber, myString, myBoolean); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnum.java index ff6b4dff8e97..d50018b999d5 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnum.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -13,14 +13,10 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java index 55e81d230056..73020e1e3b87 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java @@ -13,14 +13,10 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumInteger.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumInteger.java index 55c38bd319f2..a83925c58695 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumInteger.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumInteger.java @@ -13,14 +13,10 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java index b6156de0ce6a..383ca4227422 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java @@ -13,14 +13,10 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ParentPet.java index d7f2b66ce113..d69986aadc73 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ParentPet.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ParentPet.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -33,8 +27,6 @@ import java.util.Arrays; import org.openapitools.client.model.GrandparentAnimal; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -56,55 +48,24 @@ public class ParentPet extends GrandparentAnimal { public ParentPet() { } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public ParentPet putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 ParentPet object is equal to o. */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(super.hashCode()); } @Override @@ -112,7 +73,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ParentPet {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pet.java index 57bc29549b05..9dcc1af2c993 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pet.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -29,8 +27,6 @@ import org.openapitools.client.model.Category; import org.openapitools.client.model.Tag; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -65,7 +61,7 @@ public class Pet { public static final String JSON_PROPERTY_TAGS = "tags"; @jakarta.annotation.Nullable - private List<@Valid Tag> tags = new ArrayList<>(); + private List tags = new ArrayList<>(); /** * pet status in the store @@ -121,7 +117,6 @@ public Pet id(@jakarta.annotation.Nullable Long id) { * @return id */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ID, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -147,8 +142,6 @@ public Pet category(@jakarta.annotation.Nullable Category category) { * @return category */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -174,8 +167,6 @@ public Pet name(@jakarta.annotation.Nonnull String name) { * @return name */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_NAME, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -209,8 +200,6 @@ public Pet addPhotoUrlsItem(String photoUrlsItem) { * @return photoUrls */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -226,7 +215,7 @@ public void setPhotoUrls(@jakarta.annotation.Nonnull List photoUrls) { } - public Pet tags(@jakarta.annotation.Nullable List<@Valid Tag> tags) { + public Pet tags(@jakarta.annotation.Nullable List tags) { this.tags = tags; return this; } @@ -244,19 +233,17 @@ public Pet addTagsItem(Tag tagsItem) { * @return tags */ @jakarta.annotation.Nullable - @Valid - @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List<@Valid Tag> getTags() { + public List getTags() { return tags; } @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTags(@jakarta.annotation.Nullable List<@Valid Tag> tags) { + public void setTags(@jakarta.annotation.Nullable List tags) { this.tags = tags; } @@ -271,7 +258,6 @@ public Pet status(@jakarta.annotation.Nullable StatusEnum status) { * @return status */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -292,12 +278,24 @@ public void setStatus(@jakarta.annotation.Nullable StatusEnum status) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(id, category, name, photoUrls, tags, status); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pig.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pig.java index acc3ab45717a..ef25a4326b5c 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pig.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Pig.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -34,8 +28,6 @@ import org.openapitools.client.model.BasquePig; import org.openapitools.client.model.DanishPig; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; import com.fasterxml.jackson.core.type.TypeReference; @@ -99,22 +91,6 @@ public PigDeserializer(Class vc) { public Pig deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode tree = ctxt.readTree(jp); Object deserialized = null; - Pig newPig = new Pig(); - Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String)result2.get("className"); - switch (discriminatorValue) { - case "BasquePig": - deserialized = tree.traverse(jp.getCodec()).readValueAs(BasquePig.class); - newPig.setActualInstance(deserialized); - return newPig; - case "DanishPig": - deserialized = tree.traverse(jp.getCodec()).readValueAs(DanishPig.class); - newPig.setActualInstance(deserialized); - return newPig; - default: - log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Pig. Possible values: BasquePig DanishPig", discriminatorValue)); - } - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); @@ -173,56 +149,7 @@ public Pig getNullValue(DeserializationContext ctxt) throws JsonMappingException public Pig() { super("oneOf", Boolean.FALSE); } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public Pig putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 Pig object is equal to o. - */ - @Override - public boolean equals(Object o) { - return super.equals(o) && Objects.equals(this.additionalProperties, ((Pig)o).additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); - } public Pig(BasquePig o) { super("oneOf", Boolean.FALSE); setActualInstance(o); diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Quadrilateral.java index ad90ab7a8a47..4e23ab92c036 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Quadrilateral.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -34,8 +28,6 @@ import org.openapitools.client.model.ComplexQuadrilateral; import org.openapitools.client.model.SimpleQuadrilateral; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; import com.fasterxml.jackson.core.type.TypeReference; @@ -99,22 +91,6 @@ public QuadrilateralDeserializer(Class vc) { public Quadrilateral deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode tree = ctxt.readTree(jp); Object deserialized = null; - Quadrilateral newQuadrilateral = new Quadrilateral(); - Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String)result2.get("quadrilateralType"); - switch (discriminatorValue) { - case "ComplexQuadrilateral": - deserialized = tree.traverse(jp.getCodec()).readValueAs(ComplexQuadrilateral.class); - newQuadrilateral.setActualInstance(deserialized); - return newQuadrilateral; - case "SimpleQuadrilateral": - deserialized = tree.traverse(jp.getCodec()).readValueAs(SimpleQuadrilateral.class); - newQuadrilateral.setActualInstance(deserialized); - return newQuadrilateral; - default: - log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Quadrilateral. Possible values: ComplexQuadrilateral SimpleQuadrilateral", discriminatorValue)); - } - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); @@ -173,56 +149,7 @@ public Quadrilateral getNullValue(DeserializationContext ctxt) throws JsonMappin public Quadrilateral() { super("oneOf", Boolean.FALSE); } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public Quadrilateral putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 Quadrilateral object is equal to o. - */ - @Override - public boolean equals(Object o) { - return super.equals(o) && Objects.equals(this.additionalProperties, ((Quadrilateral)o).additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); - } public Quadrilateral(SimpleQuadrilateral o) { super("oneOf", Boolean.FALSE); setActualInstance(o); diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java index a2a89a484fa5..688d3ee7e161 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -55,8 +51,6 @@ public QuadrilateralInterface quadrilateralType(@jakarta.annotation.Nonnull Stri * @return quadrilateralType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -77,12 +71,19 @@ public void setQuadrilateralType(@jakarta.annotation.Nonnull String quadrilatera */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(quadrilateralType); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 806041d468e4..f277c0153703 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -63,7 +59,6 @@ public ReadOnlyFirst( * @return bar */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_BAR, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -84,7 +79,6 @@ public ReadOnlyFirst baz(@jakarta.annotation.Nullable String baz) { * @return baz */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_BAZ, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -105,12 +99,20 @@ public void setBaz(@jakarta.annotation.Nullable String baz) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(bar, baz); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java index 6d54c432e85d..530ccd181d6a 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -29,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -64,8 +56,6 @@ public ScaleneTriangle shapeType(@jakarta.annotation.Nonnull String shapeType) { * @return shapeType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -91,8 +81,6 @@ public ScaleneTriangle triangleType(@jakarta.annotation.Nonnull String triangleT * @return triangleType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -107,55 +95,26 @@ public void setTriangleType(@jakarta.annotation.Nonnull String triangleType) { this.triangleType = triangleType; } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public ScaleneTriangle putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 ScaleneTriangle object is equal to o. */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(shapeType, triangleType); } @Override @@ -164,7 +123,6 @@ public String toString() { sb.append("class ScaleneTriangle {\n"); sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); sb.append(" triangleType: ").append(toIndentedString(triangleType)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Shape.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Shape.java index dedc0fc269df..2b1671eb9115 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Shape.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Shape.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -34,8 +28,6 @@ import org.openapitools.client.model.Quadrilateral; import org.openapitools.client.model.Triangle; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; import com.fasterxml.jackson.core.type.TypeReference; @@ -99,22 +91,6 @@ public ShapeDeserializer(Class vc) { public Shape deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode tree = ctxt.readTree(jp); Object deserialized = null; - Shape newShape = new Shape(); - Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String)result2.get("shapeType"); - switch (discriminatorValue) { - case "Quadrilateral": - deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); - newShape.setActualInstance(deserialized); - return newShape; - case "Triangle": - deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); - newShape.setActualInstance(deserialized); - return newShape; - default: - log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Shape. Possible values: Quadrilateral Triangle", discriminatorValue)); - } - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); @@ -173,56 +149,7 @@ public Shape getNullValue(DeserializationContext ctxt) throws JsonMappingExcepti public Shape() { super("oneOf", Boolean.FALSE); } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public Shape putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 Shape object is equal to o. - */ - @Override - public boolean equals(Object o) { - return super.equals(o) && Objects.equals(this.additionalProperties, ((Shape)o).additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); - } public Shape(Triangle o) { super("oneOf", Boolean.FALSE); setActualInstance(o); diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeInterface.java index 40b2f50b212c..275fbc6644bf 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeInterface.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -55,8 +51,6 @@ public ShapeInterface shapeType(@jakarta.annotation.Nonnull String shapeType) { * @return shapeType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -77,12 +71,19 @@ public void setShapeType(@jakarta.annotation.Nonnull String shapeType) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(shapeType); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeOrNull.java index 0f92751d55bd..c7f385c28183 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeOrNull.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -34,8 +28,6 @@ import org.openapitools.client.model.Quadrilateral; import org.openapitools.client.model.Triangle; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; import com.fasterxml.jackson.core.type.TypeReference; @@ -99,22 +91,6 @@ public ShapeOrNullDeserializer(Class vc) { public ShapeOrNull deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode tree = ctxt.readTree(jp); Object deserialized = null; - ShapeOrNull newShapeOrNull = new ShapeOrNull(); - Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String)result2.get("shapeType"); - switch (discriminatorValue) { - case "Quadrilateral": - deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); - newShapeOrNull.setActualInstance(deserialized); - return newShapeOrNull; - case "Triangle": - deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); - newShapeOrNull.setActualInstance(deserialized); - return newShapeOrNull; - default: - log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for ShapeOrNull. Possible values: Quadrilateral Triangle", discriminatorValue)); - } - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); @@ -173,56 +149,7 @@ public ShapeOrNull getNullValue(DeserializationContext ctxt) throws JsonMappingE public ShapeOrNull() { super("oneOf", Boolean.TRUE); } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public ShapeOrNull putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 ShapeOrNull object is equal to o. - */ - @Override - public boolean equals(Object o) { - return super.equals(o) && Objects.equals(this.additionalProperties, ((ShapeOrNull)o).additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); - } public ShapeOrNull(Triangle o) { super("oneOf", Boolean.FALSE); setActualInstance(o); diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java index d56925add207..ab81d8d4201a 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -29,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -64,8 +56,6 @@ public SimpleQuadrilateral shapeType(@jakarta.annotation.Nonnull String shapeTyp * @return shapeType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -91,8 +81,6 @@ public SimpleQuadrilateral quadrilateralType(@jakarta.annotation.Nonnull String * @return quadrilateralType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -107,55 +95,26 @@ public void setQuadrilateralType(@jakarta.annotation.Nonnull String quadrilatera this.quadrilateralType = quadrilateralType; } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public SimpleQuadrilateral putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 SimpleQuadrilateral object is equal to o. */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(shapeType, quadrilateralType); } @Override @@ -164,7 +123,6 @@ public String toString() { sb.append("class SimpleQuadrilateral {\n"); sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SpecialModelName.java index e34277354af2..e1537ebd15b5 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -61,7 +57,6 @@ public SpecialModelName() { * @return $specialPropertyName */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -87,7 +82,6 @@ public SpecialModelName specialModelName(@jakarta.annotation.Nullable String spe * @return specialModelName */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_SPECIAL_MODEL_NAME, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -108,12 +102,20 @@ public void setSpecialModelName(@jakarta.annotation.Nullable String specialModel */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName) && + Objects.equals(this.specialModelName, specialModelName.specialModelName); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash($specialPropertyName, specialModelName); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Tag.java index a81f7ff44082..07817e57d16b 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Tag.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -60,7 +56,6 @@ public Tag id(@jakarta.annotation.Nullable Long id) { * @return id */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ID, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -86,7 +81,6 @@ public Tag name(@jakarta.annotation.Nullable String name) { * @return name */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_NAME, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -107,12 +101,20 @@ public void setName(@jakarta.annotation.Nullable String name) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(id, name); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java index 218650c2a1e8..05cdd86840ab 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonAnyGetter; @@ -29,8 +27,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -60,7 +56,6 @@ public TestInlineFreeformAdditionalPropertiesRequest someProperty(@jakarta.annot * @return someProperty */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_SOME_PROPERTY, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -118,12 +113,20 @@ public Object getAdditionalProperty(String key) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = (TestInlineFreeformAdditionalPropertiesRequest) o; + return Objects.equals(this.someProperty, testInlineFreeformAdditionalPropertiesRequest.someProperty)&& + Objects.equals(this.additionalProperties, testInlineFreeformAdditionalPropertiesRequest.additionalProperties); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(someProperty, additionalProperties); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Triangle.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Triangle.java index 7d2130da4415..db2db396b9f9 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Triangle.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Triangle.java @@ -13,12 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -35,8 +29,6 @@ import org.openapitools.client.model.IsoscelesTriangle; import org.openapitools.client.model.ScaleneTriangle; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; import com.fasterxml.jackson.core.type.TypeReference; @@ -100,26 +92,6 @@ public TriangleDeserializer(Class vc) { public Triangle deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode tree = ctxt.readTree(jp); Object deserialized = null; - Triangle newTriangle = new Triangle(); - Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String)result2.get("triangleType"); - switch (discriminatorValue) { - case "EquilateralTriangle": - deserialized = tree.traverse(jp.getCodec()).readValueAs(EquilateralTriangle.class); - newTriangle.setActualInstance(deserialized); - return newTriangle; - case "IsoscelesTriangle": - deserialized = tree.traverse(jp.getCodec()).readValueAs(IsoscelesTriangle.class); - newTriangle.setActualInstance(deserialized); - return newTriangle; - case "ScaleneTriangle": - deserialized = tree.traverse(jp.getCodec()).readValueAs(ScaleneTriangle.class); - newTriangle.setActualInstance(deserialized); - return newTriangle; - default: - log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Triangle. Possible values: EquilateralTriangle IsoscelesTriangle ScaleneTriangle", discriminatorValue)); - } - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); @@ -194,56 +166,7 @@ public Triangle getNullValue(DeserializationContext ctxt) throws JsonMappingExce public Triangle() { super("oneOf", Boolean.FALSE); } - /** - * 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 additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - */ - @JsonAnySetter - public Triangle putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap<>(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * 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 Triangle object is equal to o. - */ - @Override - public boolean equals(Object o) { - return super.equals(o) && Objects.equals(this.additionalProperties, ((Triangle)o).additionalProperties); - } - @Override - public int hashCode() { - return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); - } public Triangle(EquilateralTriangle o) { super("oneOf", Boolean.FALSE); setActualInstance(o); diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/TriangleInterface.java index 3920d3fb5447..c6fc7baab0ee 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/TriangleInterface.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -55,8 +51,6 @@ public TriangleInterface triangleType(@jakarta.annotation.Nonnull String triangl * @return triangleType */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -77,12 +71,19 @@ public void setTriangleType(@jakarta.annotation.Nonnull String triangleType) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(triangleType); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/User.java index 4702efc203d1..e003616ccee0 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/User.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -29,8 +27,6 @@ import org.openapitools.jackson.nullable.JsonNullable; import java.util.NoSuchElementException; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -111,7 +107,6 @@ public User id(@jakarta.annotation.Nullable Long id) { * @return id */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_ID, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -137,7 +132,6 @@ public User username(@jakarta.annotation.Nullable String username) { * @return username */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_USERNAME, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -163,7 +157,6 @@ public User firstName(@jakarta.annotation.Nullable String firstName) { * @return firstName */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_FIRST_NAME, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -189,7 +182,6 @@ public User lastName(@jakarta.annotation.Nullable String lastName) { * @return lastName */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_LAST_NAME, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -215,7 +207,6 @@ public User email(@jakarta.annotation.Nullable String email) { * @return email */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_EMAIL, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -241,7 +232,6 @@ public User password(@jakarta.annotation.Nullable String password) { * @return password */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_PASSWORD, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -267,7 +257,6 @@ public User phone(@jakarta.annotation.Nullable String phone) { * @return phone */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_PHONE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -293,7 +282,6 @@ public User userStatus(@jakarta.annotation.Nullable Integer userStatus) { * @return userStatus */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_USER_STATUS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -319,7 +307,6 @@ public User objectWithNoDeclaredProps(@jakarta.annotation.Nullable Object object * @return objectWithNoDeclaredProps */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -345,7 +332,6 @@ public User objectWithNoDeclaredPropsNullable(@jakarta.annotation.Nullable Objec * @return objectWithNoDeclaredPropsNullable */ @jakarta.annotation.Nullable - @JsonIgnore public Object getObjectWithNoDeclaredPropsNullable() { @@ -379,7 +365,6 @@ public User anyTypeProp(@jakarta.annotation.Nullable Object anyTypeProp) { * @return anyTypeProp */ @jakarta.annotation.Nullable - @JsonIgnore public Object getAnyTypeProp() { @@ -413,7 +398,6 @@ public User anyTypePropNullable(@jakarta.annotation.Nullable Object anyTypePropN * @return anyTypePropNullable */ @jakarta.annotation.Nullable - @JsonIgnore public Object getAnyTypePropNullable() { @@ -442,7 +426,25 @@ public void setAnyTypePropNullable(@jakarta.annotation.Nullable Object anyTypePr */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + 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.objectWithNoDeclaredProps, user.objectWithNoDeclaredProps) && + equalsNullable(this.objectWithNoDeclaredPropsNullable, user.objectWithNoDeclaredPropsNullable) && + equalsNullable(this.anyTypeProp, user.anyTypeProp) && + equalsNullable(this.anyTypePropNullable, user.anyTypePropNullable); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -451,7 +453,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, objectWithNoDeclaredProps, hashCodeNullable(objectWithNoDeclaredPropsNullable), hashCodeNullable(anyTypeProp), hashCodeNullable(anyTypePropNullable)); } private static int hashCodeNullable(JsonNullable a) { diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Whale.java index 965b4cd7c5ab..a74efed93661 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Whale.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Whale.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Objects; import java.util.Map; import java.util.HashMap; @@ -25,8 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -66,7 +62,6 @@ public Whale hasBaleen(@jakarta.annotation.Nullable Boolean hasBaleen) { * @return hasBaleen */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_HAS_BALEEN, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -92,7 +87,6 @@ public Whale hasTeeth(@jakarta.annotation.Nullable Boolean hasTeeth) { * @return hasTeeth */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_HAS_TEETH, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -118,8 +112,6 @@ public Whale className(@jakarta.annotation.Nonnull String className) { * @return className */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -140,12 +132,21 @@ public void setClassName(@jakarta.annotation.Nonnull String className) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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 HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(hasBaleen, hasTeeth, className); } @Override diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Zebra.java index 209104fdfc82..50e06af9e38f 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Zebra.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/Zebra.java @@ -13,8 +13,6 @@ package org.openapitools.client.model; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Map; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonAnyGetter; @@ -29,8 +27,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import jakarta.validation.constraints.*; -import jakarta.validation.Valid; import org.openapitools.client.JSON; @@ -102,7 +98,6 @@ public Zebra type(@jakarta.annotation.Nullable TypeEnum type) { * @return type */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -128,8 +123,6 @@ public Zebra className(@jakarta.annotation.Nonnull String className) { * @return className */ @jakarta.annotation.Nonnull - @NotNull - @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -187,12 +180,21 @@ public Object getAdditionalProperty(String key) { */ @Override public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, false, null, true); + 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); } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return Objects.hash(type, className, additionalProperties); } @Override diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/ErrorEntityIntegrationTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/ErrorEntityIntegrationTest.java new file mode 100644 index 000000000000..c3664007e4c7 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/ErrorEntityIntegrationTest.java @@ -0,0 +1,150 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.client; + +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Integration test for errorEntity feature. + * + * This test verifies that the ApiException class with errorEntity + * works correctly without requiring a live server. + */ +public class ErrorEntityIntegrationTest { + + /** + * Test errorEntity is correctly populated in ApiException + */ + @Test + public void testErrorEntityIsCorrectlyPopulated() { + // Simulate error response from server + Map errorResponse = new HashMap<>(); + errorResponse.put("code", 400); + errorResponse.put("message", "Bad Request"); + errorResponse.put("details", List.of("Field 'name' is required")); + + // Create ApiException as if it came from a 400 response + Map> headers = new HashMap<>(); + headers.put("Content-Type", List.of("application/json")); + headers.put("X-Request-Id", List.of("abc-123")); + + String responseBody = "{\"code\":400,\"message\":\"Bad Request\",\"details\":[\"Field 'name' is required\"]}"; + + ApiException exception = new ApiException( + 400, + "Bad Request", + headers, + responseBody, + errorResponse + ); + + // Verify basic properties + assertEquals(400, exception.getCode()); + assertEquals("Bad Request", exception.getMessage()); + + // Verify headers are preserved + assertEquals("application/json", exception.getResponseHeaders().get("Content-Type").get(0)); + assertEquals("abc-123", exception.getResponseHeaders().get("X-Request-Id").get(0)); + + // Verify raw response body is preserved + assertEquals(responseBody, exception.getResponseBody()); + + // Verify errorEntity is correctly deserialized + assertNotNull(exception.getErrorEntity()); + assertTrue(exception.getErrorEntity() instanceof Map); + + Map errorEntity = (Map) exception.getErrorEntity(); + assertEquals(400, errorEntity.get("code")); + assertEquals("Bad Request", errorEntity.get("message")); + assertNotNull(errorEntity.get("details")); + } + + /** + * Test errorEntity is null when not provided (backward compatibility) + */ + @Test + public void testErrorEntityIsNullWhenNotProvided() { + Map> headers = new HashMap<>(); + + ApiException exception = new ApiException( + 500, + "Internal Server Error", + headers, + "Server error occurred" + // No errorEntity passed + ); + + assertEquals(500, exception.getCode()); + assertEquals("Internal Server Error", exception.getMessage()); + assertEquals("Server error occurred", exception.getResponseBody()); + assertNull(exception.getErrorEntity(), "errorEntity should be null when not provided"); + } + + /** + * Test errorEntity is null when deserialization fails + */ + @Test + public void testErrorEntityIsNullOnDeserializationFailure() { + Map> headers = new HashMap<>(); + + // Simulate case where deserialization failed and returned null + ApiException exception = new ApiException( + 500, + "Internal Server Error", + headers, + "invalid json{", + null // errorEntity is null because deserialization failed + ); + + assertEquals(500, exception.getCode()); + assertNull(exception.getErrorEntity(), "errorEntity should be null on deserialization failure"); + } + + /** + * Test that errorEntity can hold any type of object + */ + @Test + public void testErrorEntitySupportsAnyType() { + // Test with a custom error wrapper object structure + Map customError = new HashMap<>(); + Map innerError = new HashMap<>(); + innerError.put("code", "VALIDATION_ERROR"); + innerError.put("message", "Validation failed"); + innerError.put("fields", List.of("email", "password")); + customError.put("error", innerError); + + Map> headers = new HashMap<>(); + + ApiException exception = new ApiException( + 422, + "Validation Error", + headers, + "{}", + customError + ); + + assertNotNull(exception.getErrorEntity()); + assertTrue(exception.getErrorEntity() instanceof Map); + } +} \ No newline at end of file