From 5702751e916161b9d70b4384b0ea4264d422e5b5 Mon Sep 17 00:00:00 2001 From: Cameron Koegel <53310569+ckoegel@users.noreply.github.com> Date: Sat, 9 Nov 2024 00:41:30 -0500 Subject: [PATCH] [Java] Respect User Supplied Header Params (#20042) * [Java] Respect User Supplied Header Params * remove if `dynamicOperations` true --- bin/utils/test_file_list.yaml | 2 +- .../Java/libraries/okhttp-gson/api.mustache | 15 +++--- ...points-models-for-testing-okhttp-gson.yaml | 7 +++ .../org/openapitools/client/api/PetApi.java | 9 ++-- .../openapitools/client/api/HeaderApi.java | 33 +++++++----- .../org/openapitools/client/api/FakeApi.java | 27 +++++----- .../org/openapitools/client/api/PetApi.java | 9 ++-- .../org/openapitools/client/api/PetApi.java | 9 ++-- .../org/openapitools/client/api/PetApi.java | 9 ++-- .../org/openapitools/client/api/PetApi.java | 9 ++-- .../client/api/AnotherFakeApi.java | 9 ++-- .../org/openapitools/client/api/FakeApi.java | 36 +++++++------ .../org/openapitools/client/api/PetApi.java | 9 ++-- .../openapitools/client/api/CommonApi.java | 9 ++-- .../org/openapitools/client/api/PetApi.java | 9 ++-- .../java/okhttp-gson/api/openapi.yaml | 8 +++ .../petstore/java/okhttp-gson/docs/PetApi.md | 6 ++- .../client/api/AnotherFakeApi.java | 27 +++++----- .../org/openapitools/client/api/FakeApi.java | 54 ++++++++++--------- .../org/openapitools/client/api/PetApi.java | 36 ++++++++----- .../openapitools/client/api/PetApiTest.java | 17 +++++- 21 files changed, 212 insertions(+), 137 deletions(-) diff --git a/bin/utils/test_file_list.yaml b/bin/utils/test_file_list.yaml index 31e862ffb195..fc02cc2d0a1a 100644 --- a/bin/utils/test_file_list.yaml +++ b/bin/utils/test_file_list.yaml @@ -12,6 +12,6 @@ - filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java" sha256: e673d9928c8eb848262d0116fe0d28db832e128671a810a7c966d06d90cb9b63 - filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java" - sha256: 0d64cdc11809a7b5b952ccdad2bd91bd0045b3894d6fabf3e368fa0be12b8217 + sha256: 8b1b8f2a2ad00ccb090873a94a5f73e328b98317d2ec715f53bd7a1accb2a023 - filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/PetTest.java" sha256: a1f8a70bf7b0c382a8def5bacf7b1fb189e687fabb40235aa799001e0597f545 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache index ab2f93c77d3b..48392afa4071 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -180,12 +180,6 @@ public class {{classname}} { {{/isQueryParam}} {{/constantParams}} - {{#headerParams}} - if ({{paramName}} != null) { - localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); - } - - {{/headerParams}} {{#constantParams}} {{#isHeaderParam}} // Set client side default value of Header Param "{{baseName}}". @@ -230,6 +224,15 @@ public class {{classname}} { if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } + {{^dynamicOperations}} + {{#headerParams}} + + if ({{paramName}} != null) { + localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + } + + {{/headerParams}} + {{/dynamicOperations}} String[] localVarAuthNames = new String[] { {{#withAWSV4Signature}}"AWS4Auth"{{/withAWSV4Signature}}{{#authMethods}}{{#-first}}{{#withAWSV4Signature}}, {{/withAWSV4Signature}}{{/-first}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; return localVarApiClient.buildCall(basePath, localVarPath, {{^dynamicOperations}}"{{httpMethod}}"{{/dynamicOperations}}{{#dynamicOperations}}apiOperation.getMethod(){{/dynamicOperations}}, localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); diff --git a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml index f0354608d319..fa56ab5043cf 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml @@ -258,6 +258,13 @@ paths: schema: type: integer format: int64 + - name: Content-Type + in: header + style: simple + description: Content type header parameter + required: false + schema: + type: string responses: '200': description: successful operation diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/api/PetApi.java index 2c57d0c17dcd..cb11874cf81c 100644 --- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/api/PetApi.java @@ -242,10 +242,6 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (apiKey != null) { - localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -260,6 +256,11 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ localVarHeaderParams.put("Content-Type", localVarContentType); } + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/api/HeaderApi.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/api/HeaderApi.java index f68a4d345229..0c23515d3210 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/api/HeaderApi.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/api/HeaderApi.java @@ -113,40 +113,45 @@ public okhttp3.Call testHeaderIntegerBooleanStringEnumsCall(Integer integerHeade Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + if (integerHeader != null) { localVarHeaderParams.put("integer_header", localVarApiClient.parameterToString(integerHeader)); } + if (booleanHeader != null) { localVarHeaderParams.put("boolean_header", localVarApiClient.parameterToString(booleanHeader)); } + if (stringHeader != null) { localVarHeaderParams.put("string_header", localVarApiClient.parameterToString(stringHeader)); } + if (enumNonrefStringHeader != null) { localVarHeaderParams.put("enum_nonref_string_header", localVarApiClient.parameterToString(enumNonrefStringHeader)); } + if (enumRefStringHeader != null) { localVarHeaderParams.put("enum_ref_string_header", localVarApiClient.parameterToString(enumRefStringHeader)); } - final String[] localVarAccepts = { - "text/plain" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/FakeApi.java index c342b4a442cd..6132bbb32df8 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/FakeApi.java @@ -806,10 +806,6 @@ public okhttp3.Call refToRefParameterCall(UUID refToUuid, final ApiCallback _cal Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (refToUuid != null) { - localVarHeaderParams.put("ref_to_uuid", localVarApiClient.parameterToString(refToUuid)); - } - final String[] localVarAccepts = { "text/plain" }; @@ -825,6 +821,11 @@ public okhttp3.Call refToRefParameterCall(UUID refToUuid, final ApiCallback _cal localVarHeaderParams.put("Content-Type", localVarContentType); } + if (refToUuid != null) { + localVarHeaderParams.put("ref_to_uuid", localVarApiClient.parameterToString(refToUuid)); + } + + String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -932,10 +933,6 @@ public okhttp3.Call refToRefParameterAnyofCall(RefToRefParameterAnyofRefToAnyofP Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (refToAnyof != null) { - localVarHeaderParams.put("ref_to_anyof", localVarApiClient.parameterToString(refToAnyof)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -950,6 +947,11 @@ public okhttp3.Call refToRefParameterAnyofCall(RefToRefParameterAnyofRefToAnyofP localVarHeaderParams.put("Content-Type", localVarContentType); } + if (refToAnyof != null) { + localVarHeaderParams.put("ref_to_anyof", localVarApiClient.parameterToString(refToAnyof)); + } + + String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -1053,10 +1055,6 @@ public okhttp3.Call refToRefParameterOneofCall(RefRefToPathLevelParameterOneofRe Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (refToOneof != null) { - localVarHeaderParams.put("ref_to_oneof", localVarApiClient.parameterToString(refToOneof)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -1071,6 +1069,11 @@ public okhttp3.Call refToRefParameterOneofCall(RefRefToPathLevelParameterOneofRe localVarHeaderParams.put("Content-Type", localVarContentType); } + if (refToOneof != null) { + localVarHeaderParams.put("ref_to_oneof", localVarApiClient.parameterToString(refToOneof)); + } + + String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/PetApi.java index 2c57d0c17dcd..cb11874cf81c 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/api/PetApi.java @@ -242,10 +242,6 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (apiKey != null) { - localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -260,6 +256,11 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ localVarHeaderParams.put("Content-Type", localVarContentType); } + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/api/PetApi.java index e0a4ead87dd4..9e8a6325e953 100644 --- a/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/api/PetApi.java @@ -242,10 +242,6 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (apiKey != null) { - localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -260,6 +256,11 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ localVarHeaderParams.put("Content-Type", localVarContentType); } + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "petstore_auth" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/api/PetApi.java index f0f45aecf96f..6fd71ca5f3bd 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/api/PetApi.java @@ -259,10 +259,6 @@ private okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (apiKey != null) { - localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -277,6 +273,11 @@ private okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback localVarHeaderParams.put("Content-Type", localVarContentType); } + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/api/PetApi.java index b2dd8b28254d..21b9050e3a21 100644 --- a/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/api/PetApi.java @@ -232,10 +232,6 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (apiKey != null) { - localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -250,6 +246,11 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ localVarHeaderParams.put("Content-Type", localVarContentType); } + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 6c87a69c007e..b2f680364d3f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -111,10 +111,6 @@ public okhttp3.Call call123testSpecialTagsCall(UUID uuidTest, Client body, final Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (uuidTest != null) { - localVarHeaderParams.put("uuid_test", localVarApiClient.parameterToString(uuidTest)); - } - final String[] localVarAccepts = { "application/json" }; @@ -131,6 +127,11 @@ public okhttp3.Call call123testSpecialTagsCall(UUID uuidTest, Client body, final localVarHeaderParams.put("Content-Type", localVarContentType); } + if (uuidTest != null) { + localVarHeaderParams.put("uuid_test", localVarApiClient.parameterToString(uuidTest)); + } + + String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java index c4f7380e9b8a..1926dfe5fd47 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java @@ -1357,14 +1357,6 @@ public okhttp3.Call testEnumParametersCall(List enumHeaderStringArray, S localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_double", enumQueryDouble)); } - if (enumHeaderStringArray != null) { - localVarHeaderParams.put("enum_header_string_array", localVarApiClient.parameterToString(enumHeaderStringArray)); - } - - if (enumHeaderString != null) { - localVarHeaderParams.put("enum_header_string", localVarApiClient.parameterToString(enumHeaderString)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -1380,6 +1372,16 @@ public okhttp3.Call testEnumParametersCall(List enumHeaderStringArray, S localVarHeaderParams.put("Content-Type", localVarContentType); } + if (enumHeaderStringArray != null) { + localVarHeaderParams.put("enum_header_string_array", localVarApiClient.parameterToString(enumHeaderStringArray)); + } + + + if (enumHeaderString != null) { + localVarHeaderParams.put("enum_header_string", localVarApiClient.parameterToString(enumHeaderString)); + } + + String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -1506,14 +1508,6 @@ private okhttp3.Call testGroupParametersCall(Integer requiredStringGroup, Boolea localVarQueryParams.addAll(localVarApiClient.parameterToPair("int64_group", int64Group)); } - if (requiredBooleanGroup != null) { - localVarHeaderParams.put("required_boolean_group", localVarApiClient.parameterToString(requiredBooleanGroup)); - } - - if (booleanGroup != null) { - localVarHeaderParams.put("boolean_group", localVarApiClient.parameterToString(booleanGroup)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -1528,6 +1522,16 @@ private okhttp3.Call testGroupParametersCall(Integer requiredStringGroup, Boolea localVarHeaderParams.put("Content-Type", localVarContentType); } + if (requiredBooleanGroup != null) { + localVarHeaderParams.put("required_boolean_group", localVarApiClient.parameterToString(requiredBooleanGroup)); + } + + + if (booleanGroup != null) { + localVarHeaderParams.put("boolean_group", localVarApiClient.parameterToString(booleanGroup)); + } + + String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java index 0738fc989558..b96732ccae99 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java @@ -238,10 +238,6 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (apiKey != null) { - localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -256,6 +252,11 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ localVarHeaderParams.put("Content-Type", localVarContentType); } + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/api/CommonApi.java b/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/api/CommonApi.java index acf847d569b3..cc0fc2a9bc27 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/api/CommonApi.java +++ b/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/api/CommonApi.java @@ -721,10 +721,6 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (apiKey != null) { - localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -739,6 +735,11 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ localVarHeaderParams.put("Content-Type", localVarContentType); } + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/api/PetApi.java index 2c57d0c17dcd..cb11874cf81c 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/api/PetApi.java @@ -242,10 +242,6 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (apiKey != null) { - localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -260,6 +256,11 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ localVarHeaderParams.put("Content-Type", localVarContentType); } + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml index edfc304ae253..c20e25778928 100644 --- a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml +++ b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml @@ -300,6 +300,14 @@ paths: format: int64 type: integer style: simple + - description: Content type header parameter + explode: false + in: header + name: Content-Type + required: false + schema: + type: string + style: simple requestBody: content: multipart/form-data: diff --git a/samples/client/petstore/java/okhttp-gson/docs/PetApi.md b/samples/client/petstore/java/okhttp-gson/docs/PetApi.md index bfdf00b0f1a3..c7fa83cbbb77 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/PetApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/PetApi.md @@ -496,7 +496,7 @@ null (empty response body) # **uploadFile** -> ModelApiResponse uploadFile(petId, additionalMetadata, _file) +> ModelApiResponse uploadFile(petId, contentType, additionalMetadata, _file) uploads an image @@ -523,10 +523,11 @@ public class Example { PetApi apiInstance = new PetApi(defaultClient); Long petId = 56L; // Long | ID of pet to update + String contentType = "contentType_example"; // String | Content type header parameter String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server File _file = new File("/path/to/file"); // File | file to upload try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + ModelApiResponse result = apiInstance.uploadFile(petId, contentType, additionalMetadata, _file); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling PetApi#uploadFile"); @@ -544,6 +545,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **petId** | **Long**| ID of pet to update | | +| **contentType** | **String**| Content type header parameter | [optional] | | **additionalMetadata** | **String**| Additional data to pass to server | [optional] | | **_file** | **File**| file to upload | [optional] | diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index a58d4bf127b5..10095ce7725a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -233,10 +233,6 @@ public okhttp3.Call getParameterArrayNumberCall(List array, final ApiCa Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (array != null) { - localVarHeaderParams.put("array", localVarApiClient.parameterToString(array)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -251,6 +247,11 @@ public okhttp3.Call getParameterArrayNumberCall(List array, final ApiCa localVarHeaderParams.put("Content-Type", localVarContentType); } + if (array != null) { + localVarHeaderParams.put("array", localVarApiClient.parameterToString(array)); + } + + String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -354,10 +355,6 @@ public okhttp3.Call getParameterStringNumberCall(BigDecimal stringNumber, final Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (stringNumber != null) { - localVarHeaderParams.put("string_number", localVarApiClient.parameterToString(stringNumber)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -372,6 +369,11 @@ public okhttp3.Call getParameterStringNumberCall(BigDecimal stringNumber, final localVarHeaderParams.put("Content-Type", localVarContentType); } + if (stringNumber != null) { + localVarHeaderParams.put("string_number", localVarApiClient.parameterToString(stringNumber)); + } + + String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -475,10 +477,6 @@ public okhttp3.Call nullRequestBodyCall(String acceptLanguage, final ApiCallback Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (acceptLanguage != null) { - localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -494,6 +492,11 @@ public okhttp3.Call nullRequestBodyCall(String acceptLanguage, final ApiCallback localVarHeaderParams.put("Content-Type", localVarContentType); } + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java index 68ef0840fccb..ab713371f1df 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java @@ -1197,14 +1197,6 @@ public okhttp3.Call getParameterNameMappingCall(Long underscoreType, String type localVarQueryParams.addAll(localVarApiClient.parameterToPair("type", type)); } - if (underscoreType != null) { - localVarHeaderParams.put("_type", localVarApiClient.parameterToString(underscoreType)); - } - - if (typeWithUnderscore != null) { - localVarHeaderParams.put("type_", localVarApiClient.parameterToString(typeWithUnderscore)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -1219,6 +1211,16 @@ public okhttp3.Call getParameterNameMappingCall(Long underscoreType, String type localVarHeaderParams.put("Content-Type", localVarContentType); } + if (underscoreType != null) { + localVarHeaderParams.put("_type", localVarApiClient.parameterToString(underscoreType)); + } + + + if (typeWithUnderscore != null) { + localVarHeaderParams.put("type_", localVarApiClient.parameterToString(typeWithUnderscore)); + } + + String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -2105,14 +2107,6 @@ public okhttp3.Call testEnumParametersCall(List enumHeaderStringArray, S localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_double", enumQueryDouble)); } - if (enumHeaderStringArray != null) { - localVarHeaderParams.put("enum_header_string_array", localVarApiClient.parameterToString(enumHeaderStringArray)); - } - - if (enumHeaderString != null) { - localVarHeaderParams.put("enum_header_string", localVarApiClient.parameterToString(enumHeaderString)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -2128,6 +2122,16 @@ public okhttp3.Call testEnumParametersCall(List enumHeaderStringArray, S localVarHeaderParams.put("Content-Type", localVarContentType); } + if (enumHeaderStringArray != null) { + localVarHeaderParams.put("enum_header_string_array", localVarApiClient.parameterToString(enumHeaderStringArray)); + } + + + if (enumHeaderString != null) { + localVarHeaderParams.put("enum_header_string", localVarApiClient.parameterToString(enumHeaderString)); + } + + String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -2254,14 +2258,6 @@ private okhttp3.Call testGroupParametersCall(Integer requiredStringGroup, Boolea localVarQueryParams.addAll(localVarApiClient.parameterToPair("int64_group", int64Group)); } - if (requiredBooleanGroup != null) { - localVarHeaderParams.put("required_boolean_group", localVarApiClient.parameterToString(requiredBooleanGroup)); - } - - if (booleanGroup != null) { - localVarHeaderParams.put("boolean_group", localVarApiClient.parameterToString(booleanGroup)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -2276,6 +2272,16 @@ private okhttp3.Call testGroupParametersCall(Integer requiredStringGroup, Boolea localVarHeaderParams.put("Content-Type", localVarContentType); } + if (requiredBooleanGroup != null) { + localVarHeaderParams.put("required_boolean_group", localVarApiClient.parameterToString(requiredBooleanGroup)); + } + + + if (booleanGroup != null) { + localVarHeaderParams.put("boolean_group", localVarApiClient.parameterToString(booleanGroup)); + } + + String[] localVarAuthNames = new String[] { "bearer_test" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java index 338a5585f008..0025da43d6dd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java @@ -232,10 +232,6 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (apiKey != null) { - localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); - } - final String[] localVarAccepts = { }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -250,6 +246,11 @@ public okhttp3.Call deletePetCall(Long petId, String apiKey, final ApiCallback _ localVarHeaderParams.put("Content-Type", localVarContentType); } + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -987,6 +988,7 @@ public okhttp3.Call updatePetWithFormAsync(Long petId, String name, String statu /** * Build call for uploadFile * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) * @param additionalMetadata Additional data to pass to server (optional) * @param _file file to upload (optional) * @param _callback Callback for upload/download progress @@ -998,7 +1000,7 @@ public okhttp3.Call updatePetWithFormAsync(Long petId, String name, String statu 200 successful operation - */ - public okhttp3.Call uploadFileCall(Long petId, String additionalMetadata, File _file, final ApiCallback _callback) throws ApiException { + public okhttp3.Call uploadFileCall(Long petId, String contentType, String additionalMetadata, File _file, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -1048,18 +1050,23 @@ public okhttp3.Call uploadFileCall(Long petId, String additionalMetadata, File _ localVarHeaderParams.put("Content-Type", localVarContentType); } + if (contentType != null) { + localVarHeaderParams.put("Content-Type", localVarApiClient.parameterToString(contentType)); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String additionalMetadata, File _file, final ApiCallback _callback) throws ApiException { + private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String contentType, String additionalMetadata, File _file, final ApiCallback _callback) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); } - return uploadFileCall(petId, additionalMetadata, _file, _callback); + return uploadFileCall(petId, contentType, additionalMetadata, _file, _callback); } @@ -1067,6 +1074,7 @@ private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String additionalM * uploads an image * * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) * @param additionalMetadata Additional data to pass to server (optional) * @param _file file to upload (optional) * @return ModelApiResponse @@ -1077,8 +1085,8 @@ private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String additionalM 200 successful operation - */ - public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File _file) throws ApiException { - ApiResponse localVarResp = uploadFileWithHttpInfo(petId, additionalMetadata, _file); + public ModelApiResponse uploadFile(Long petId, String contentType, String additionalMetadata, File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, contentType, additionalMetadata, _file); return localVarResp.getData(); } @@ -1086,6 +1094,7 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File _ * uploads an image * * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) * @param additionalMetadata Additional data to pass to server (optional) * @param _file file to upload (optional) * @return ApiResponse<ModelApiResponse> @@ -1096,8 +1105,8 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File _ 200 successful operation - */ - public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File _file) throws ApiException { - okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, null); + public ApiResponse uploadFileWithHttpInfo(Long petId, String contentType, String additionalMetadata, File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, contentType, additionalMetadata, _file, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -1106,6 +1115,7 @@ public ApiResponse uploadFileWithHttpInfo(Long petId, String a * uploads an image (asynchronously) * * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) * @param additionalMetadata Additional data to pass to server (optional) * @param _file file to upload (optional) * @param _callback The callback to be executed when the API call finishes @@ -1117,9 +1127,9 @@ public ApiResponse uploadFileWithHttpInfo(Long petId, String a 200 successful operation - */ - public okhttp3.Call uploadFileAsync(Long petId, String additionalMetadata, File _file, final ApiCallback _callback) throws ApiException { + public okhttp3.Call uploadFileAsync(Long petId, String contentType, String additionalMetadata, File _file, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, _callback); + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, contentType, additionalMetadata, _file, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java index 89fe1d01c460..9a9a777af869 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -399,7 +399,22 @@ public void testUploadFile() throws Exception { writer.write("Hello world!"); writer.close(); - api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath())); + // respect user supplied content type + ApiResponse formDataResponse = api.uploadFileWithHttpInfo(pet.getId(), "multipart/form-data", "a test file", new File(file.getAbsolutePath())); + assertEquals(200, formDataResponse.getStatusCode()); + + // use default content type + ApiResponse defaultResponse = api.uploadFileWithHttpInfo(pet.getId(), null, "a test file", new File(file.getAbsolutePath())); + assertEquals(200, defaultResponse.getStatusCode()); + + try { + // use invalid content type + api.uploadFileWithHttpInfo(pet.getId(), "image/jpeg", "a test file", new File(file.getAbsolutePath())); + } catch (ApiException e) { + LOG.info("Code: {}. Message: {}", e.getCode(), e.getMessage()); + assertEquals(415, e.getCode()); + } + api.deletePet(pet.getId(), null); }