diff --git a/bin/configs/java-jersey2-8.yaml b/bin/configs/java-jersey2-8.yaml index c10332368de3..f968aac62307 100644 --- a/bin/configs/java-jersey2-8.yaml +++ b/bin/configs/java-jersey2-8.yaml @@ -2,6 +2,7 @@ generatorName: java outputDir: samples/openapi3/client/petstore/java/jersey2-java8 library: jersey2 inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +templateDir: modules/openapi-generator/src/main/resources/Java additionalProperties: artifactId: petstore-openapi3-jersey2-java8 hideGenerationTimestamp: true diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 50e35cf40d11..7e18a8a393cb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -1486,20 +1486,20 @@ public DefaultCodegen() { // option to change how we process + set the data in the 'additionalProperties' keyword. CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean( - CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, - CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC).defaultValue(Boolean.TRUE.toString()); + CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, + CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC).defaultValue(Boolean.TRUE.toString()); Map disallowAdditionalPropertiesIfNotPresentOpts = new HashMap<>(); disallowAdditionalPropertiesIfNotPresentOpts.put("false", - "The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications."); + "The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications."); disallowAdditionalPropertiesIfNotPresentOpts.put("true", - "when the 'additionalProperties' keyword is not present in a schema, " + - "the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. " + - "Note: this mode is not compliant with the JSON schema specification. " + - "This is the original openapi-generator behavior."); + "when the 'additionalProperties' keyword is not present in a schema, " + + "the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. " + + "Note: this mode is not compliant with the JSON schema specification. " + + "This is the original openapi-generator behavior."); disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts); cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt); this.setDisallowAdditionalPropertiesIfNotPresent(true); - + // initialize special character mapping initalizeSpecialCharacterMapping(); @@ -2640,7 +2640,7 @@ private Discriminator recursiveGetDiscriminator(Schema sc, OpenAPI openAPI) { Integer hasDiscriminatorCnt = 0; Integer hasNullTypeCnt = 0; Set discriminatorsPropNames = new HashSet<>(); - for (Schema oneOf: composedSchema.getOneOf()) { + for (Schema oneOf : composedSchema.getOneOf()) { if (ModelUtils.isNullType(oneOf)) { // The null type does not have a discriminator. Skip. hasNullTypeCnt++; @@ -2654,7 +2654,7 @@ private Discriminator recursiveGetDiscriminator(Schema sc, OpenAPI openAPI) { } if (discriminatorsPropNames.size() > 1) { throw new RuntimeException("The oneOf schemas have conflicting discriminator property names. " + - "oneOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames)); + "oneOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames)); } if ((hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) { disc.setPropertyName(foundDisc.getPropertyName()); @@ -2669,7 +2669,7 @@ private Discriminator recursiveGetDiscriminator(Schema sc, OpenAPI openAPI) { Integer hasDiscriminatorCnt = 0; Integer hasNullTypeCnt = 0; Set discriminatorsPropNames = new HashSet<>(); - for (Schema anyOf: composedSchema.getAnyOf()) { + for (Schema anyOf : composedSchema.getAnyOf()) { if (ModelUtils.isNullType(anyOf)) { // The null type does not have a discriminator. Skip. hasNullTypeCnt++; @@ -2720,7 +2720,7 @@ protected List getOneOfAnyOfDescendants(String composedSchemaName, if (schemaList == null) { continue; } - for (Schema sc: schemaList) { + for (Schema sc : schemaList) { if (ModelUtils.isNullType(sc)) { continue; } @@ -2875,7 +2875,7 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch * Handle the model for the 'additionalProperties' keyword in the OAS schema. * * @param codegenModel The codegen representation of the schema. - * @param schema the input OAS schema. + * @param schema The input OAS schema. */ protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) { addParentContainer(codegenModel, codegenModel.name, schema); @@ -3503,7 +3503,7 @@ protected void handleMethodResponse(Operation operation, op.returnType = cm.dataType; op.returnFormat = cm.dataFormat; op.hasReference = schemas != null && schemas.containsKey(op.returnBaseType); - + // lookup discriminator Schema schema = schemas.get(op.returnBaseType); if (schema != null) { @@ -3965,8 +3965,8 @@ public CodegenResponse fromResponse(String responseCode, ApiResponse response) { r.containerType = cp.containerType; r.isMapContainer = "map".equals(cp.containerType); r.isListContainer = "list".equalsIgnoreCase(cp.containerType) || - "array".equalsIgnoreCase(cp.containerType) || - "set".equalsIgnoreCase(cp.containerType); + "array".equalsIgnoreCase(cp.containerType) || + "set".equalsIgnoreCase(cp.containerType); } else { r.simpleType = true; } @@ -4317,7 +4317,7 @@ public boolean isDataTypeBinary(String dataType) { return false; } } - + // TODO revise below as it should be replaced by ModelUtils.isFileSchema(parameterSchema) public boolean isDataTypeFile(String dataType) { if (dataType != null) { @@ -5795,6 +5795,7 @@ private void addBodyModelSchema(CodegenParameter codegenParameter, String name, codegenParameter.baseType = codegenModel.classname; codegenParameter.dataType = getTypeDeclaration(codegenModel.classname); codegenParameter.description = codegenModel.description; + codegenParameter.isNullable = codegenModel.isNullable; imports.add(codegenParameter.baseType); } else { CodegenProperty codegenProperty = fromProperty("property", schema); @@ -5808,6 +5809,7 @@ private void addBodyModelSchema(CodegenParameter codegenParameter, String name, codegenParameter.baseType = codegenParameter.baseName; codegenParameter.dataType = getTypeDeclaration(codegenModelName); codegenParameter.description = codegenProperty.getDescription(); + codegenParameter.isNullable = codegenProperty.isNullable; } else { if (ModelUtils.isMapSchema(schema)) {// http body is map LOGGER.error("Map should be supported. Please report to openapi-generator github repo about the issue."); @@ -5916,6 +5918,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S codegenParameter.baseType = getSchemaType(inner); codegenParameter.isContainer = Boolean.TRUE; codegenParameter.isMapContainer = Boolean.TRUE; + codegenParameter.isNullable = codegenProperty.isNullable; setParameterBooleanFlagWithCodegenProperty(codegenParameter, codegenProperty); @@ -5958,6 +5961,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S codegenParameter.baseType = getSchemaType(inner); codegenParameter.isContainer = Boolean.TRUE; codegenParameter.isListContainer = Boolean.TRUE; + codegenParameter.isNullable = codegenProperty.isNullable; setParameterBooleanFlagWithCodegenProperty(codegenParameter, codegenProperty); // set nullable @@ -5981,6 +5985,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S codegenParameter.baseType = codegenProperty.baseType; codegenParameter.dataType = codegenProperty.dataType; codegenParameter.description = codegenProperty.description; + codegenParameter.isNullable = codegenProperty.isNullable; codegenParameter.paramName = toParamName(codegenParameter.baseName); } setParameterBooleanFlagWithCodegenProperty(codegenParameter, codegenProperty); @@ -6010,6 +6015,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S codegenParameter.minLength = codegenProperty.minLength; codegenParameter.maxLength = codegenProperty.maxLength; codegenParameter.pattern = codegenProperty.pattern; + codegenParameter.isNullable = codegenProperty.isNullable; if (codegenProperty.complexType != null) { imports.add(codegenProperty.complexType); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache index a14b0c16f772..9d726cc93dc2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache @@ -839,7 +839,7 @@ public class ApiClient { * @return Entity * @throws ApiException API exception */ - public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { + public Entity serialize(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { Entity entity; if (contentType.startsWith("multipart/form-data")) { MultiPart multiPart = new MultiPart(); @@ -863,7 +863,11 @@ public class ApiClient { entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); } else { // We let jersey handle the serialization - entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType); + if (isBodyNullable) { // payload is nullable + entity = Entity.entity(obj == null ? Entity.text("null") : obj, contentType); + } else { + entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType); + } } return entity; } @@ -874,10 +878,11 @@ public class ApiClient { * @param obj Object * @param formParams Form parameters * @param contentType Context type + * @param isBodyNulalble True if the body is nullable * @return String * @throws ApiException API exception */ - public String serializeToString(Object obj, Map formParams, String contentType) throws ApiException { + public String serializeToString(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { try { if (contentType.startsWith("multipart/form-data")) { throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)"); @@ -893,7 +898,11 @@ public class ApiClient { return formString.substring(0, formString.length() - 1); } } else { - return json.getMapper().writeValueAsString(obj); + if (isBodyNullable) { + return obj == null ? "null" : json.getMapper().writeValueAsString(obj); + } else { + return json.getMapper().writeValueAsString(obj); + } } } catch (Exception ex) { throw new ApiException("Failed to perform serializeToString: " + ex.toString()); @@ -1007,6 +1016,7 @@ public class ApiClient { * @param contentType The request's Content-Type header * @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 * @return The response body in type of string * @throws ApiException API exception */ @@ -1022,7 +1032,8 @@ public class ApiClient { String accept, String contentType, String[] authNames, - GenericType returnType) + GenericType returnType, + boolean isBodyNullable) throws ApiException { // Not using `.target(targetURL).path(path)` below, @@ -1069,7 +1080,7 @@ public class ApiClient { } } - Entity entity = serialize(body, formParams, contentType); + Entity entity = serialize(body, formParams, contentType, isBodyNullable); // put all headers in one place Map allHeaderParams = new HashMap<>(defaultHeaderMap); @@ -1081,7 +1092,7 @@ public class ApiClient { queryParams, allHeaderParams, cookieParams, - serializeToString(body, formParams, contentType), + serializeToString(body, formParams, contentType, isBodyNullable), method, target.getUri()); @@ -1170,8 +1181,8 @@ public class ApiClient { * @deprecated Add qualified name of the operation as a first parameter. */ @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) throws ApiException { - return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType); + 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); } /** diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache index 16f7ef45b8c0..5fcfb9b19bb3 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache @@ -167,7 +167,7 @@ public class {{classname}} { {{/returnType}} return apiClient.invokeAPI("{{classname}}.{{operationId}}", localVarPath, "{{httpMethod}}", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}); + localVarAuthNames, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, {{#bodyParam}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}false{{/bodyParam}}); } {{#vendorExtensions.x-group-parameters}} diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index b4d1f44d9d67..b619597d990c 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -756,7 +756,7 @@ public String escapeString(String str) { * @return Entity * @throws ApiException API exception */ - public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { + public Entity serialize(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { Entity entity; if (contentType.startsWith("multipart/form-data")) { MultiPart multiPart = new MultiPart(); @@ -780,7 +780,11 @@ public Entity serialize(Object obj, Map formParams, String co entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); } else { // We let jersey handle the serialization - entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType); + if (isBodyNullable) { // payload is nullable + entity = Entity.entity(obj == null ? Entity.text("null") : obj, contentType); + } else { + entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType); + } } return entity; } @@ -791,10 +795,11 @@ public Entity serialize(Object obj, Map formParams, String co * @param obj Object * @param formParams Form parameters * @param contentType Context type + * @param isBodyNulalble True if the body is nullable * @return String * @throws ApiException API exception */ - public String serializeToString(Object obj, Map formParams, String contentType) throws ApiException { + public String serializeToString(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { try { if (contentType.startsWith("multipart/form-data")) { throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)"); @@ -810,7 +815,11 @@ public String serializeToString(Object obj, Map formParams, Stri return formString.substring(0, formString.length() - 1); } } else { - return json.getMapper().writeValueAsString(obj); + if (isBodyNullable) { + return obj == null ? "null" : json.getMapper().writeValueAsString(obj); + } else { + return json.getMapper().writeValueAsString(obj); + } } } catch (Exception ex) { throw new ApiException("Failed to perform serializeToString: " + ex.toString()); @@ -918,6 +927,7 @@ public File prepareDownloadFile(Response response) throws IOException { * @param contentType The request's Content-Type header * @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 * @return The response body in type of string * @throws ApiException API exception */ @@ -933,7 +943,8 @@ public ApiResponse invokeAPI( String accept, String contentType, String[] authNames, - GenericType returnType) + GenericType returnType, + boolean isBodyNullable) throws ApiException { // Not using `.target(targetURL).path(path)` below, @@ -980,7 +991,7 @@ public ApiResponse invokeAPI( } } - Entity entity = serialize(body, formParams, contentType); + Entity entity = serialize(body, formParams, contentType, isBodyNullable); // put all headers in one place Map allHeaderParams = new HashMap<>(defaultHeaderMap); @@ -992,7 +1003,7 @@ public ApiResponse invokeAPI( queryParams, allHeaderParams, cookieParams, - serializeToString(body, formParams, contentType), + serializeToString(body, formParams, contentType, isBodyNullable), method, target.getUri()); @@ -1079,8 +1090,8 @@ private Response sendRequest(String method, Invocation.Builder invocationBuilder * @deprecated Add qualified name of the operation as a first parameter. */ @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) throws ApiException { - return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType); + 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); } /** diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 71f267cfb539..00a2e3fcd4b4 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -110,6 +110,6 @@ public ApiResponse call123testSpecialTagsWithHttpInfo(Client body) throw return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } } diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java index d722d3f1a0fd..170ca91a961f 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java @@ -115,7 +115,7 @@ public ApiResponse createXmlItemWithHttpInfo(XmlItem xmlItem) throws ApiEx return apiClient.invokeAPI("FakeApi.createXmlItem", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * @@ -177,7 +177,7 @@ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * @@ -239,7 +239,7 @@ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(Outer return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * @@ -301,7 +301,7 @@ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal b return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * @@ -363,7 +363,7 @@ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) thr return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * @@ -427,7 +427,7 @@ public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * @@ -499,7 +499,7 @@ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * To test \"client\" model @@ -566,7 +566,7 @@ public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiEx return apiClient.invokeAPI("FakeApi.testClientModel", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -701,7 +701,7 @@ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, D return apiClient.invokeAPI("FakeApi.testEndpointParameters", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * To test enum parameters @@ -788,7 +788,7 @@ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderS return apiClient.invokeAPI("FakeApi.testEnumParameters", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } private ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { @@ -844,7 +844,7 @@ private ApiResponse testGroupParametersWithHttpInfo(Integer requiredString return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } public class APItestGroupParametersRequest { @@ -1023,7 +1023,7 @@ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map testJsonFormDataWithHttpInfo(String param, String param return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * @@ -1195,6 +1195,6 @@ public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(List testClassnameWithHttpInfo(Client body) throws ApiExce return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } } diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java index 601ccd197048..71fe54b109ea 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java @@ -112,7 +112,7 @@ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Deletes a pet @@ -183,7 +183,7 @@ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Finds Pets by status @@ -253,7 +253,7 @@ public ApiResponse> findPetsByStatusWithHttpInfo(List status) return apiClient.invokeAPI("PetApi.findPetsByStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Finds Pets by tags @@ -327,7 +327,7 @@ public ApiResponse> findPetsByTagsWithHttpInfo(Set tags) throws return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Find pet by ID @@ -399,7 +399,7 @@ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Update an existing pet @@ -469,7 +469,7 @@ public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Updates a pet in the store with form data @@ -542,7 +542,7 @@ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * uploads an image @@ -618,7 +618,7 @@ public ApiResponse uploadFileWithHttpInfo(Long petId, String a return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * uploads an image (required) @@ -699,6 +699,6 @@ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } } diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java index 31f441e5e1ba..0d259914167b 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java @@ -110,7 +110,7 @@ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiExcep return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Returns pet inventories by status @@ -170,7 +170,7 @@ public ApiResponse> getInventoryWithHttpInfo() throws ApiEx return apiClient.invokeAPI("StoreApi.getInventory", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Find purchase order by ID @@ -242,7 +242,7 @@ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiExcep return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Place an order for a pet @@ -311,6 +311,6 @@ public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } } diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java index 5dc1dd791c39..cf1f8c794073 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java @@ -107,7 +107,7 @@ public ApiResponse createUserWithHttpInfo(User body) throws ApiException { return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Creates list of users with given input array @@ -171,7 +171,7 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Creates list of users with given input array @@ -235,7 +235,7 @@ public ApiResponse createUsersWithListInputWithHttpInfo(List body) t return apiClient.invokeAPI("UserApi.createUsersWithListInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Delete user @@ -302,7 +302,7 @@ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiExcep return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Get user by user name @@ -374,7 +374,7 @@ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiEx return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Logs user into the system @@ -452,7 +452,7 @@ public ApiResponse loginUserWithHttpInfo(String username, String passwor return apiClient.invokeAPI("UserApi.loginUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Logs out current logged in user session @@ -509,7 +509,7 @@ public ApiResponse logoutUserWithHttpInfo() throws ApiException { return apiClient.invokeAPI("UserApi.logoutUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Updated user @@ -583,6 +583,6 @@ public ApiResponse updateUserWithHttpInfo(String username, User body) thro return apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index 63dbd385df52..2afd13332401 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -835,7 +835,7 @@ public String escapeString(String str) { * @return Entity * @throws ApiException API exception */ - public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { + public Entity serialize(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { Entity entity; if (contentType.startsWith("multipart/form-data")) { MultiPart multiPart = new MultiPart(); @@ -859,7 +859,11 @@ public Entity serialize(Object obj, Map formParams, String co entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); } else { // We let jersey handle the serialization - entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType); + if (isBodyNullable) { // payload is nullable + entity = Entity.entity(obj == null ? Entity.text("null") : obj, contentType); + } else { + entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType); + } } return entity; } @@ -870,10 +874,11 @@ public Entity serialize(Object obj, Map formParams, String co * @param obj Object * @param formParams Form parameters * @param contentType Context type + * @param isBodyNulalble True if the body is nullable * @return String * @throws ApiException API exception */ - public String serializeToString(Object obj, Map formParams, String contentType) throws ApiException { + public String serializeToString(Object obj, Map formParams, String contentType, boolean isBodyNullable) throws ApiException { try { if (contentType.startsWith("multipart/form-data")) { throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)"); @@ -889,7 +894,11 @@ public String serializeToString(Object obj, Map formParams, Stri return formString.substring(0, formString.length() - 1); } } else { - return json.getMapper().writeValueAsString(obj); + if (isBodyNullable) { + return obj == null ? "null" : json.getMapper().writeValueAsString(obj); + } else { + return json.getMapper().writeValueAsString(obj); + } } } catch (Exception ex) { throw new ApiException("Failed to perform serializeToString: " + ex.toString()); @@ -997,6 +1006,7 @@ public File prepareDownloadFile(Response response) throws IOException { * @param contentType The request's Content-Type header * @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 * @return The response body in type of string * @throws ApiException API exception */ @@ -1012,7 +1022,8 @@ public ApiResponse invokeAPI( String accept, String contentType, String[] authNames, - GenericType returnType) + GenericType returnType, + boolean isBodyNullable) throws ApiException { // Not using `.target(targetURL).path(path)` below, @@ -1059,7 +1070,7 @@ public ApiResponse invokeAPI( } } - Entity entity = serialize(body, formParams, contentType); + Entity entity = serialize(body, formParams, contentType, isBodyNullable); // put all headers in one place Map allHeaderParams = new HashMap<>(defaultHeaderMap); @@ -1071,7 +1082,7 @@ public ApiResponse invokeAPI( queryParams, allHeaderParams, cookieParams, - serializeToString(body, formParams, contentType), + serializeToString(body, formParams, contentType, isBodyNullable), method, target.getUri()); @@ -1158,8 +1169,8 @@ private Response sendRequest(String method, Invocation.Builder invocationBuilder * @deprecated Add qualified name of the operation as a first parameter. */ @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) throws ApiException { - return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType); + 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); } /** diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 2f2160899f82..7a9f7b08b63e 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -110,6 +110,6 @@ public ApiResponse call123testSpecialTagsWithHttpInfo(Client client) thr return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java index 4444a7191f88..a49fdc11d859 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -103,6 +103,6 @@ public ApiResponse fooGetWithHttpInfo() throws ApiExcepti return apiClient.invokeAPI("DefaultApi.fooGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java index dacb046a1dfc..b8893ee704f7 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java @@ -112,7 +112,7 @@ public ApiResponse fakeHealthGetWithHttpInfo() throws ApiExce return apiClient.invokeAPI("FakeApi.fakeHealthGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * @@ -174,7 +174,7 @@ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * @@ -236,7 +236,7 @@ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(Outer return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * @@ -298,7 +298,7 @@ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal b return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * @@ -360,7 +360,7 @@ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) thr return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Array of Enums @@ -420,7 +420,7 @@ public ApiResponse> getArrayOfEnumsWithHttpInfo() throws ApiExce return apiClient.invokeAPI("FakeApi.getArrayOfEnums", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * @@ -484,7 +484,7 @@ public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * @@ -556,7 +556,7 @@ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * To test \"client\" model @@ -623,7 +623,7 @@ public ApiResponse testClientModelWithHttpInfo(Client client) throws Api return apiClient.invokeAPI("FakeApi.testClientModel", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -758,7 +758,7 @@ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, D return apiClient.invokeAPI("FakeApi.testEndpointParameters", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * To test enum parameters @@ -845,7 +845,7 @@ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderS return apiClient.invokeAPI("FakeApi.testEnumParameters", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } private ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { @@ -901,7 +901,7 @@ private ApiResponse testGroupParametersWithHttpInfo(Integer requiredString return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } public class APItestGroupParametersRequest { @@ -1080,7 +1080,7 @@ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map testJsonFormDataWithHttpInfo(String param, String param return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * @@ -1252,6 +1252,6 @@ public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(List testClassnameWithHttpInfo(Client client) throws ApiEx return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java index 6cd72b9701ea..3637b9e61a5a 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java @@ -109,7 +109,7 @@ public ApiResponse addPetWithHttpInfo(Pet pet) throws ApiException { return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Deletes a pet @@ -178,7 +178,7 @@ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Finds Pets by status @@ -248,7 +248,7 @@ public ApiResponse> findPetsByStatusWithHttpInfo(List status) return apiClient.invokeAPI("PetApi.findPetsByStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Finds Pets by tags @@ -322,7 +322,7 @@ public ApiResponse> findPetsByTagsWithHttpInfo(List tags) thro return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Find pet by ID @@ -394,7 +394,7 @@ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Update an existing pet @@ -462,7 +462,7 @@ public ApiResponse updatePetWithHttpInfo(Pet pet) throws ApiException { return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Updates a pet in the store with form data @@ -535,7 +535,7 @@ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * uploads an image @@ -611,7 +611,7 @@ public ApiResponse uploadFileWithHttpInfo(Long petId, String a return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * uploads an image (required) @@ -692,6 +692,6 @@ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java index eb4f5d3db86e..75fa95592c05 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java @@ -110,7 +110,7 @@ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiExcep return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Returns pet inventories by status @@ -170,7 +170,7 @@ public ApiResponse> getInventoryWithHttpInfo() throws ApiEx return apiClient.invokeAPI("StoreApi.getInventory", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Find purchase order by ID @@ -242,7 +242,7 @@ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiExcep return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Place an order for a pet @@ -311,6 +311,6 @@ public ApiResponse placeOrderWithHttpInfo(Order order) throws ApiExceptio return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java index 0e0f07dca9fd..bdf2c62fcf0a 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java @@ -107,7 +107,7 @@ public ApiResponse createUserWithHttpInfo(User user) throws ApiException { return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Creates list of users with given input array @@ -171,7 +171,7 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(List user) return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Creates list of users with given input array @@ -235,7 +235,7 @@ public ApiResponse createUsersWithListInputWithHttpInfo(List user) t return apiClient.invokeAPI("UserApi.createUsersWithListInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Delete user @@ -302,7 +302,7 @@ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiExcep return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Get user by user name @@ -374,7 +374,7 @@ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiEx return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Logs user into the system @@ -452,7 +452,7 @@ public ApiResponse loginUserWithHttpInfo(String username, String passwor return apiClient.invokeAPI("UserApi.loginUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType); + localVarAuthNames, localVarReturnType, false); } /** * Logs out current logged in user session @@ -509,7 +509,7 @@ public ApiResponse logoutUserWithHttpInfo() throws ApiException { return apiClient.invokeAPI("UserApi.logoutUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } /** * Updated user @@ -583,6 +583,6 @@ public ApiResponse updateUserWithHttpInfo(String username, User user) thro return apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null); + localVarAuthNames, null, false); } }