From cd936a66fdbb0d2e27e42868553a9efa709626f6 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 19 Jan 2021 10:52:46 +0800 Subject: [PATCH 01/54] [Nim] test the petstore client in drone.io (#8466) * test nim client in drone.io * trigger build failure * Revert "trigger build failure" This reverts commit 7253c8ad3bb72456f2995134701c6bbce8f31c64. --- CI/.drone.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CI/.drone.yml b/CI/.drone.yml index 7df20d5e7f2..49495e43094 100644 --- a/CI/.drone.yml +++ b/CI/.drone.yml @@ -2,6 +2,11 @@ kind: pipeline name: default steps: +# test nim client +- name: nim-client-test + image: nimlang/nim + commands: + - (cd samples/client/petstore/nim/ && nim c sample_client.nim) # test protobuf schema generator - name: protobuf-schema-test image: nanoservice/protobuf-go From 83e9986bba16c003b62b43d16f515cf80cf8a5a2 Mon Sep 17 00:00:00 2001 From: Sakari Bergen Date: Tue, 19 Jan 2021 05:04:27 +0200 Subject: [PATCH 02/54] Style fix: correct copy-paste mistake in test package name (#8451) --- .../codegen/csharpnetcore/CSharpNetCoreClientCodegenTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpNetCoreClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpNetCoreClientCodegenTest.java index 0d28f8f255a..3a6ce1df371 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpNetCoreClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpNetCoreClientCodegenTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openapitools.codegen.csharp; +package org.openapitools.codegen.csharpnetcore; import org.openapitools.codegen.languages.CSharpNetCoreClientCodegen; import org.testng.Assert; From 6e4c1307a768fca44dd5f2dce14e85e77d9c8387 Mon Sep 17 00:00:00 2001 From: Vladimir L Date: Tue, 19 Jan 2021 04:33:17 +0100 Subject: [PATCH 03/54] use '{{#hasPathParams}}' instead of '{{#pathParams}}' to avoid path repetiotion if path contains multiple parameters (#8402) --- .../src/main/resources/nim-client/api.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/nim-client/api.mustache b/modules/openapi-generator/src/main/resources/nim-client/api.mustache index 55e57bc4752..9e464f8661d 100644 --- a/modules/openapi-generator/src/main/resources/nim-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/nim-client/api.mustache @@ -48,8 +48,8 @@ proc {{{operationId}}}*(httpClient: HttpClient{{#allParams}}, {{{paramName}}}: { {{/formParams}} }){{/isMultipart}}{{/hasFormParams}}{{#returnType}} - let response = httpClient.{{{httpMethod}}}(basepath & {{^pathParams}}"{{{path}}}"{{/pathParams}}{{#pathParams}}fmt"{{{path}}}"{{/pathParams}}{{#hasQueryParams}} & "?" & query_for_api_call{{/hasQueryParams}}{{#hasBodyParam}}{{#bodyParams}}, $(%{{{paramName}}}){{/bodyParams}}{{/hasBodyParam}}{{#hasFormParams}}, {{^isMultipart}}$query_for_api_call{{/isMultipart}}{{#isMultipart}}multipart=query_for_api_call{{/isMultipart}}{{/hasFormParams}}) + let response = httpClient.{{{httpMethod}}}(basepath & {{^pathParams}}"{{{path}}}"{{/pathParams}}{{#hasPathParams}}fmt"{{{path}}}"{{/hasPathParams}}{{#hasQueryParams}} & "?" & query_for_api_call{{/hasQueryParams}}{{#hasBodyParam}}{{#bodyParams}}, $(%{{{paramName}}}){{/bodyParams}}{{/hasBodyParam}}{{#hasFormParams}}, {{^isMultipart}}$query_for_api_call{{/isMultipart}}{{#isMultipart}}multipart=query_for_api_call{{/isMultipart}}{{/hasFormParams}}) constructResult[{{{returnType}}}](response){{/returnType}}{{^returnType}} - httpClient.{{{httpMethod}}}(basepath & {{^pathParams}}"{{{path}}}"{{/pathParams}}{{#pathParams}}fmt"{{{path}}}"{{/pathParams}}{{#hasQueryParams}} & "?" & query_for_api_call{{/hasQueryParams}}{{#hasBodyParam}}{{#bodyParams}}, $(%{{{paramName}}}){{/bodyParams}}{{/hasBodyParam}}{{#hasFormParams}}, {{^isMultipart}}$query_for_api_call{{/isMultipart}}{{#isMultipart}}multipart=query_for_api_call{{/isMultipart}}{{/hasFormParams}}){{/returnType}} + httpClient.{{{httpMethod}}}(basepath & {{^pathParams}}"{{{path}}}"{{/pathParams}}{{#hasPathParams}}fmt"{{{path}}}"{{/hasPathParams}}{{#hasQueryParams}} & "?" & query_for_api_call{{/hasQueryParams}}{{#hasBodyParam}}{{#bodyParams}}, $(%{{{paramName}}}){{/bodyParams}}{{/hasBodyParam}}{{#hasFormParams}}, {{^isMultipart}}$query_for_api_call{{/isMultipart}}{{#isMultipart}}multipart=query_for_api_call{{/isMultipart}}{{/hasFormParams}}){{/returnType}} {{/operation}}{{/operations}} \ No newline at end of file From ede2a2316c9ce6845f2374a4994b8b362e8b1f35 Mon Sep 17 00:00:00 2001 From: Hugo Alves Date: Tue, 19 Jan 2021 04:41:25 +0000 Subject: [PATCH 04/54] [JAVA][Feign] Replace Apache oltu with scribejava (#8318) * - Replace apache oltu with scribejava - Implement the following authentication methods - ApiKey header - HTTP basic authentication - Oauth client credentials flow - Oauth Implicit flow - Oauth Pasword (deprecated) * Create class hierarchy for Oauth flows implementation * Add instructions of how to use the ApiClient to Readme.md * Update samples * Remove support for java 6 and 7 * Remove java 6 and 7 support from gradle * Format pom.xml * Remove empty line * Update samples * Remove oltu dependency from build.gradle and build.sbt. Replace oltu with ScribeJava Update samples * Update samples * Update samples --- .../gradlew.bat | 200 ++++++------- .../codegen/languages/JavaClientCodegen.java | 4 + .../resources/Java/auth/OAuthFlow.mustache | 6 +- .../Java/libraries/feign/ApiClient.mustache | 169 ++++------- .../Java/libraries/feign/README.mustache | 36 ++- .../feign/auth/DefaultApi20Impl.mustache | 47 ++++ .../Java/libraries/feign/auth/OAuth.mustache | 235 ++++------------ .../auth/OauthClientCredentialsGrant.mustache | 39 +++ .../feign/auth/OauthPasswordGrant.mustache | 48 ++++ .../libraries/feign/build.gradle.mustache | 29 +- .../Java/libraries/feign/build.sbt.mustache | 2 +- .../Java/libraries/feign/pom.mustache | 66 ++--- .../.openapi-generator/FILES | 3 + .../petstore/java/feign-no-nullable/README.md | 36 ++- .../java/feign-no-nullable/build.gradle | 13 +- .../petstore/java/feign-no-nullable/build.sbt | 2 +- .../petstore/java/feign-no-nullable/pom.xml | 22 +- .../org/openapitools/client/ApiClient.java | 163 ++++------- .../client/auth/DefaultApi20Impl.java | 47 ++++ .../org/openapitools/client/auth/OAuth.java | 235 ++++------------ .../openapitools/client/auth/OAuthFlow.java | 6 +- .../auth/OauthClientCredentialsGrant.java | 39 +++ .../client/auth/OauthPasswordGrant.java | 48 ++++ .../java/feign/.openapi-generator/FILES | 3 + samples/client/petstore/java/feign/README.md | 36 ++- .../client/petstore/java/feign/build.gradle | 13 +- samples/client/petstore/java/feign/build.sbt | 2 +- samples/client/petstore/java/feign/pom.xml | 22 +- .../org/openapitools/client/ApiClient.java | 163 ++++------- .../client/auth/DefaultApi20Impl.java | 47 ++++ .../org/openapitools/client/auth/OAuth.java | 235 ++++------------ .../openapitools/client/auth/OAuthFlow.java | 6 +- .../auth/OauthClientCredentialsGrant.java | 39 +++ .../client/auth/OauthPasswordGrant.java | 48 ++++ .../openapitools/client/auth/OAuthFlow.java | 6 +- .../openapitools/client/auth/OAuthFlow.java | 6 +- .../openapitools/client/auth/OAuthFlow.java | 6 +- .../openapitools/client/auth/OAuthFlow.java | 6 +- .../openapitools/client/auth/OAuthFlow.java | 6 +- .../openapitools/client/auth/OAuthFlow.java | 6 +- .../openapitools/client/auth/OAuthFlow.java | 6 +- .../openapitools/client/auth/OAuthFlow.java | 6 +- .../java-undertow/dependency-reduced-pom.xml | 262 +++++++++--------- 43 files changed, 1208 insertions(+), 1211 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/DefaultApi20Impl.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthClientCredentialsGrant.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthPasswordGrant.mustache create mode 100644 samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java create mode 100644 samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java create mode 100644 samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java create mode 100644 samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java create mode 100644 samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java create mode 100644 samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java diff --git a/modules/openapi-generator-gradle-plugin/gradlew.bat b/modules/openapi-generator-gradle-plugin/gradlew.bat index 24467a141f7..9618d8d9607 100644 --- a/modules/openapi-generator-gradle-plugin/gradlew.bat +++ b/modules/openapi-generator-gradle-plugin/gradlew.bat @@ -1,100 +1,100 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index a0ce92fac1c..f7053bd900c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -392,6 +392,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON); supportingFiles.add(new SupportingFile("ParamExpander.mustache", invokerFolder, "ParamExpander.java")); supportingFiles.add(new SupportingFile("EncodingUtils.mustache", invokerFolder, "EncodingUtils.java")); + supportingFiles.add(new SupportingFile("auth/DefaultApi20Impl.mustache", authFolder, "DefaultApi20Impl.java")); + supportingFiles.add(new SupportingFile("auth/OauthPasswordGrant.mustache", authFolder, "OauthPasswordGrant.java")); + supportingFiles.add(new SupportingFile("auth/OauthClientCredentialsGrant.mustache", authFolder, "OauthClientCredentialsGrant.java")); + } else if (OKHTTP_GSON.equals(getLibrary()) || StringUtils.isEmpty(getLibrary())) { // the "okhttp-gson" library template requires "ApiCallback.mustache" for async call supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java")); diff --git a/modules/openapi-generator/src/main/resources/Java/auth/OAuthFlow.mustache b/modules/openapi-generator/src/main/resources/Java/auth/OAuthFlow.mustache index 002e9572f33..07b7f3aa673 100644 --- a/modules/openapi-generator/src/main/resources/Java/auth/OAuthFlow.mustache +++ b/modules/openapi-generator/src/main/resources/Java/auth/OAuthFlow.mustache @@ -2,6 +2,10 @@ package {{invokerPackage}}.auth; +{{>generatedAnnotation}} public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, //called authorizationCode in OpenAPI 3.0 + implicit, + password, + application //called clientCredentials in OpenAPI 3.0 } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache index 691f337c7c5..54201a1c615 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache @@ -2,11 +2,8 @@ package {{invokerPackage}}; import java.util.LinkedHashMap; import java.util.Map; - -{{#hasOAuthMethods}} -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; -{{/hasOAuthMethods}} +import java.util.logging.Level; +import java.util.logging.Logger; {{#threetenbp}} import org.threeten.bp.*; @@ -41,6 +38,8 @@ import {{invokerPackage}}.auth.OAuth.AccessTokenListener; {{>generatedAnnotation}} public class ApiClient { + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + public interface Api {} protected ObjectMapper objectMapper; @@ -60,6 +59,7 @@ public class ApiClient { public ApiClient(String[] authNames) { this(); for(String authName : authNames) { + log.log(Level.FINE, "Creating authentication {0}", authName); {{#hasAuthMethods}} RequestInterceptor auth; {{#authMethods}}if ("{{name}}".equals(authName)) { @@ -75,7 +75,7 @@ public class ApiClient { auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"); {{/isApiKey}} {{#isOAuth}} - auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); + auth = buildOauthRequestInterceptor(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); {{/isOAuth}} } else {{/authMethods}}{ throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); @@ -106,36 +106,6 @@ public class ApiClient { this.setApiKey(apiKey); } - /** - * Helper constructor for single basic auth or password oauth2 - * @param authName - * @param username - * @param password - */ - public ApiClient(String authName, String username, String password) { - this(authName); - this.setCredentials(username, password); - } - - {{#hasOAuthMethods}} - /** - * Helper constructor for single password oauth2 - * @param authName - * @param clientId - * @param secret - * @param username - * @param password - */ - public ApiClient(String authName, String clientId, String secret, String username, String password) { - this(authName); - this.getTokenEndPoint() - .setClientId(clientId) - .setClientSecret(secret) - .setUsername(username) - .setPassword(password); - } - - {{/hasOAuthMethods}} public String getBasePath() { return basePath; } @@ -190,10 +160,25 @@ public class ApiClient { return objectMapper; } + private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { + switch (flow) { + case password: + return new OauthPasswordGrant(tokenUrl, scopes); + case application: + return new OauthClientCredentialsGrant(authorizationUrl, tokenUrl, scopes); + default: + throw new RuntimeException("Oauth flow \"" + flow + "\" is not implemented"); + } + } + public ObjectMapper getObjectMapper(){ return objectMapper; } + public void setObjectMapper(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + /** * Creates a feign client for given API interface. * @@ -240,19 +225,13 @@ public class ApiClient { return contentTypes[0]; } - /** * Helper method to configure the bearer token. * @param bearerToken the bearer token. */ public void setBearerToken(String bearerToken) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof HttpBearerAuth) { - ((HttpBearerAuth) apiAuthorization).setBearerToken(bearerToken); - return; - } - } - throw new RuntimeException("No Bearer authentication configured!"); + HttpBearerAuth apiAuthorization = getAuthorization(HttpBearerAuth.class); + apiAuthorization.setBearerToken(bearerToken); } /** @@ -260,66 +239,39 @@ public class ApiClient { * @param apiKey API key */ public void setApiKey(String apiKey) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof ApiKeyAuth) { - ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization; - keyAuth.setApiKey(apiKey); - return ; - } - } - throw new RuntimeException("No API key authentication configured!"); + ApiKeyAuth apiAuthorization = getAuthorization(ApiKeyAuth.class); + apiAuthorization.setApiKey(apiKey); } /** - * Helper method to configure the username/password for basic auth or password OAuth + * Helper method to configure the username/password for basic auth * @param username Username * @param password Password */ public void setCredentials(String username, String password) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof HttpBasicAuth) { - HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization; - basicAuth.setCredentials(username, password); - return; - } - {{#hasOAuthMethods}} - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.getTokenRequestBuilder().setUsername(username).setPassword(password); - return; - } - {{/hasOAuthMethods}} - } - throw new RuntimeException("No Basic authentication or OAuth configured!"); + HttpBasicAuth apiAuthorization = getAuthorization(HttpBasicAuth.class); + apiAuthorization.setCredentials(username, password); } {{#hasOAuthMethods}} /** - * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Token request builder + * Helper method to configure the client credentials for Oauth + * @param username Username + * @param password Password */ - public TokenRequestBuilder getTokenEndPoint() { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - return oauth.getTokenRequestBuilder(); - } - } - return null; + public void setClientCredentials(String clientId, String clientSecret) { + OauthClientCredentialsGrant authorization = getAuthorization(OauthClientCredentialsGrant.class); + authorization.configure(clientId, clientSecret); } /** - * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Authentication request builder + * Helper method to configure the username/password for Oauth password grant + * @param username Username + * @param password Password */ - public AuthenticationRequestBuilder getAuthorizationEndPoint() { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - return oauth.getAuthenticationRequestBuilder(); - } - } - return null; + public void setOauthPassword(String username, String password, String clientId, String clientSecret) { + OauthPasswordGrant apiAuthorization = getAuthorization(OauthPasswordGrant.class); + apiAuthorization.configure(username, password, clientId, clientSecret); } /** @@ -327,14 +279,9 @@ public class ApiClient { * @param accessToken Access Token * @param expiresIn Validity period in seconds */ - public void setAccessToken(String accessToken, Long expiresIn) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.setAccessToken(accessToken, expiresIn); - return; - } - } + public void setAccessToken(String accessToken, Integer expiresIn) { + OAuth apiAuthorization = getAuthorization(OAuth.class); + apiAuthorization.setAccessToken(accessToken, expiresIn); } /** @@ -344,19 +291,7 @@ public class ApiClient { * @param redirectURI Redirect URI */ public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.getTokenRequestBuilder() - .setClientId(clientId) - .setClientSecret(clientSecret) - .setRedirectURI(redirectURI); - oauth.getAuthenticationRequestBuilder() - .setClientId(clientId) - .setRedirectURI(redirectURI); - return; - } - } + throw new RuntimeException("Not implemented"); } /** @@ -364,13 +299,8 @@ public class ApiClient { * @param accessTokenListener Acesss token listener */ public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.registerAccessTokenListener(accessTokenListener); - return; - } - } + OAuth apiAuthorization = getAuthorization(OAuth.class); + apiAuthorization.registerAccessTokenListener(accessTokenListener); } {{/hasOAuthMethods}} @@ -396,4 +326,11 @@ public class ApiClient { feignBuilder.requestInterceptor(authorization); } + private T getAuthorization(Class type) { + return (T) apiAuthorizations.values() + .stream() + .filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass())) + .findFirst() + .orElseThrow(() -> new RuntimeException("No Oauth authentication or OAuth configured!")); + } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/README.mustache index a0fac9d41df..acab659406d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/README.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/README.mustache @@ -32,6 +32,41 @@ After the client library is installed/deployed, you can use it in your Maven pro ``` +And to use the api you can follow the examples bellow: + +```java + + //Set bearer token manually + ApiClient apiClient = new ApiClient("petstore_auth_client"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setAccessToken("TOKEN", 10000); + + //Use api key + ApiClient apiClient = new ApiClient("api_key", "API KEY"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + + //Use http basic authentication + ApiClient apiClient = new ApiClient("basicAuth"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setCredentials("username", "password"); + + //Oauth password + ApiClient apiClient = new ApiClient("oauth_password"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setOauthPassword("username", "password", "client_id", "client_secret"); + + //Oauth client credentials flow + ApiClient apiClient = new ApiClient("oauth_client_credentials"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setClientCredentials("client_id", "client_secret"); + + PetApi petApi = apiClient.buildClient(PetApi.class); + Pet petById = petApi.getPetById(12345L); + + System.out.println(petById); + } +``` + ## Recommendation It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. @@ -40,4 +75,3 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea {{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} {{/-last}}{{/apis}}{{/apiInfo}} - diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/DefaultApi20Impl.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/DefaultApi20Impl.mustache new file mode 100644 index 00000000000..72b0a00495e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/DefaultApi20Impl.mustache @@ -0,0 +1,47 @@ +package {{invokerPackage}}.auth; + +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor; +import com.github.scribejava.core.extractors.TokenExtractor; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth2.bearersignature.BearerSignature; +import com.github.scribejava.core.oauth2.bearersignature.BearerSignatureURIQueryParameter; +import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; +import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; + +{{>generatedAnnotation}} +public class DefaultApi20Impl extends DefaultApi20 { + + private final String accessTokenEndpoint; + private final String authorizationBaseUrl; + + protected DefaultApi20Impl(String authorizationBaseUrl, String accessTokenEndpoint) { + this.authorizationBaseUrl = authorizationBaseUrl; + this.accessTokenEndpoint = accessTokenEndpoint; + } + + @Override + public String getAccessTokenEndpoint() { + return accessTokenEndpoint; + } + + @Override + protected String getAuthorizationBaseUrl() { + return authorizationBaseUrl; + } + + @Override + public BearerSignature getBearerSignature() { + return BearerSignatureURIQueryParameter.instance(); + } + + @Override + public ClientAuthentication getClientAuthentication() { + return RequestBodyAuthenticationScheme.instance(); + } + + @Override + public TokenExtractor getAccessTokenExtractor() { + return OAuth2AccessTokenJsonExtractor.instance(); + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OAuth.mustache index b451e97ae6e..864ee3fe3a5 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OAuth.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OAuth.mustache @@ -1,198 +1,81 @@ package {{invokerPackage}}.auth; -import java.io.IOException; -import java.util.Collection; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.oltu.oauth2.client.HttpClient; -import org.apache.oltu.oauth2.client.OAuthClient; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; -import org.apache.oltu.oauth2.client.response.OAuthClientResponse; -import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; -import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; -import org.apache.oltu.oauth2.common.exception.OAuthProblemException; -import org.apache.oltu.oauth2.common.exception.OAuthSystemException; -import org.apache.oltu.oauth2.common.message.types.GrantType; -import org.apache.oltu.oauth2.common.token.BasicOAuthToken; - -import feign.Client; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth.OAuth20Service; import feign.Request.HttpMethod; -import feign.Request.Options; import feign.RequestInterceptor; import feign.RequestTemplate; -import feign.Response; import feign.RetryableException; -import feign.Util; -import {{invokerPackage}}.StringUtil; +{{>generatedAnnotation}} +public abstract class OAuth implements RequestInterceptor { -public class OAuth implements RequestInterceptor { + static final int MILLIS_PER_SECOND = 1000; - static final int MILLIS_PER_SECOND = 1000; + public interface AccessTokenListener { + void notify(OAuth2AccessToken token); + } - public interface AccessTokenListener { - void notify(BasicOAuthToken token); + private volatile String accessToken; + private Long expirationTimeMillis; + private AccessTokenListener accessTokenListener; + + protected OAuth20Service service; + protected String scopes; + protected String authorizationUrl; + protected String tokenUrl; + + public OAuth(String authorizationUrl, String tokenUrl, String scopes) { + this.scopes = scopes; + this.authorizationUrl = authorizationUrl; + this.tokenUrl = tokenUrl; + } + + @Override + public void apply(RequestTemplate template) { + // If the request already have an authorization (eg. Basic auth), do nothing + if (template.headers().containsKey("Authorization")) { + return; } - - private volatile String accessToken; - private Long expirationTimeMillis; - private OAuthClient oauthClient; - private TokenRequestBuilder tokenRequestBuilder; - private AuthenticationRequestBuilder authenticationRequestBuilder; - private AccessTokenListener accessTokenListener; - - public OAuth(Client client, TokenRequestBuilder requestBuilder) { - this.oauthClient = new OAuthClient(new OAuthFeignClient(client)); - this.tokenRequestBuilder = requestBuilder; + // If first time, get the token + if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) { + updateAccessToken(template); } - - public OAuth(Client client, OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { - this(client, OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes)); - - switch(flow) { - case accessCode: - case implicit: - tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); - break; - case password: - tokenRequestBuilder.setGrantType(GrantType.PASSWORD); - break; - case application: - tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); - break; - default: - break; - } - authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl); + if (getAccessToken() != null) { + template.header("Authorization", "Bearer " + getAccessToken()); } + } - public OAuth(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { - this(new Client.Default(null, null), flow, authorizationUrl, tokenUrl, scopes); + private synchronized void updateAccessToken(RequestTemplate template) { + OAuth2AccessToken accessTokenResponse; + try { + accessTokenResponse = getOAuth2AccessToken(); + } catch (Exception e) { + throw new RetryableException(0, e.getMessage(), HttpMethod.POST, e, null, template.request()); } - - @Override - public void apply(RequestTemplate template) { - // If the request already have an authorization (eg. Basic auth), do nothing - if (template.headers().containsKey("Authorization")) { - return; - } - // If first time, get the token - if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) { - updateAccessToken(template); - } - if (getAccessToken() != null) { - template.header("Authorization", "Bearer " + getAccessToken()); - } + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn()); + if (accessTokenListener != null) { + accessTokenListener.notify(accessTokenResponse); + } } + } - public synchronized void updateAccessToken(RequestTemplate template) { - OAuthJSONAccessTokenResponse accessTokenResponse; - try { - accessTokenResponse = oauthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); - } catch (Exception e) { - throw new RetryableException(0, e.getMessage(), HttpMethod.POST, e, null, template.request()); - } - if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { - setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn()); - if (accessTokenListener != null) { - accessTokenListener.notify((BasicOAuthToken) accessTokenResponse.getOAuthToken()); - } - } - } + abstract OAuth2AccessToken getOAuth2AccessToken(); - public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - this.accessTokenListener = accessTokenListener; - } + abstract OAuthFlow getFlow(); - public synchronized String getAccessToken() { - return accessToken; - } + public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) { + this.accessTokenListener = accessTokenListener; + } - public synchronized void setAccessToken(String accessToken, Long expiresIn) { - this.accessToken = accessToken; - this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND; - } + public synchronized String getAccessToken() { + return accessToken; + } - public TokenRequestBuilder getTokenRequestBuilder() { - return tokenRequestBuilder; - } + public synchronized void setAccessToken(String accessToken, Integer expiresIn) { + this.accessToken = accessToken; + this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND; + } - public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { - this.tokenRequestBuilder = tokenRequestBuilder; - } - - public AuthenticationRequestBuilder getAuthenticationRequestBuilder() { - return authenticationRequestBuilder; - } - - public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) { - this.authenticationRequestBuilder = authenticationRequestBuilder; - } - - public OAuthClient getOauthClient() { - return oauthClient; - } - - public void setOauthClient(OAuthClient oauthClient) { - this.oauthClient = oauthClient; - } - - public void setOauthClient(Client client) { - this.oauthClient = new OAuthClient( new OAuthFeignClient(client)); - } - - public static class OAuthFeignClient implements HttpClient { - - private Client client; - - public OAuthFeignClient() { - this.client = new Client.Default(null, null); - } - - public OAuthFeignClient(Client client) { - this.client = client; - } - - public T execute(OAuthClientRequest request, Map headers, - String requestMethod, Class responseClass) - throws OAuthSystemException, OAuthProblemException { - - RequestTemplate req = new RequestTemplate() - .append(request.getLocationUri()) - .method(requestMethod) - .body(request.getBody()); - - for (Entry entry : headers.entrySet()) { - req.header(entry.getKey(), entry.getValue()); - } - Response feignResponse; - String body = ""; - try { - feignResponse = client.execute(req.request(), new Options()); - body = Util.toString(feignResponse.body().asReader()); - } catch (IOException e) { - throw new OAuthSystemException(e); - } - - String contentType = null; - Collection contentTypeHeader = feignResponse.headers().get("Content-Type"); - if(contentTypeHeader != null) { - contentType = StringUtil.join(contentTypeHeader.toArray(new String[0]), ";"); - } - - return OAuthClientResponseFactory.createCustomResponse( - body, - contentType, - feignResponse.status(), - responseClass - ); - } - - public void shutdown() { - // Nothing to do here - } - } -} +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthClientCredentialsGrant.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthClientCredentialsGrant.mustache new file mode 100644 index 00000000000..ef22c211637 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthClientCredentialsGrant.mustache @@ -0,0 +1,39 @@ +package {{invokerPackage}}.auth; + +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth2AccessToken; + +{{>generatedAnnotation}} +public class OauthClientCredentialsGrant extends OAuth { + + public OauthClientCredentialsGrant(String authorizationUrl, String tokenUrl, String scopes) { + super(authorizationUrl, tokenUrl, scopes); + } + + @Override + protected OAuth2AccessToken getOAuth2AccessToken() { + try { + return service.getAccessTokenClientCredentialsGrant(scopes); + } catch (Exception e) { + throw new RuntimeException("Failed to get oauth token", e); + } + } + + @Override + protected OAuthFlow getFlow() { + return OAuthFlow.application; + } + + /** + * Configures the client credentials flow + * + * @param clientId + * @param clientSecret + */ + public void configure(String clientId, String clientSecret) { + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .defaultScope(scopes) + .build(new DefaultApi20Impl(authorizationUrl, tokenUrl)); + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthPasswordGrant.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthPasswordGrant.mustache new file mode 100644 index 00000000000..870c3755a8b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthPasswordGrant.mustache @@ -0,0 +1,48 @@ +package {{invokerPackage}}.auth; + +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth2AccessToken; + +{{>generatedAnnotation}} +public class OauthPasswordGrant extends OAuth { + + private String username; + private String password; + + public OauthPasswordGrant(String tokenUrl, String scopes) { + super(null, tokenUrl, scopes); + } + + @Override + protected OAuth2AccessToken getOAuth2AccessToken() { + try { + return service.getAccessTokenPasswordGrant(username, password); + } catch (Exception e) { + throw new RuntimeException("Failed to get oauth token", e); + } + } + + @Override + protected OAuthFlow getFlow() { + return OAuthFlow.password; + } + + /** + * Configures Oauth password grant flow + * Note: this flow is deprecated. + * + * @param username + * @param password + * @param clientId + * @param clientSecret + */ + public void configure(String username, String password, String clientId, String clientSecret) { + this.username = username; + this.password = password; + //TODO the clientId and secret are optional according with the RFC + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .defaultScope(scopes) + .build(new DefaultApi20Impl(authorizationUrl, tokenUrl)); + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache index 3e00fb91797..ae4a04c11b3 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache @@ -33,20 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - {{#supportJava6}} - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} - {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - {{/java8}} - {{/supportJava6}} } // Rename the aar correctly @@ -91,20 +79,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - {{#supportJava6}} - sourceCompatibility = JavaVersion.VERSION_1_6 - targetCompatibility = JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} - {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - {{/java8}} - {{^java8}} - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 - {{/java8}} - {{/supportJava6}} install { repositories.mavenInstaller { @@ -131,7 +107,7 @@ ext { feign_version = "10.11" feign_form_version = "3.8.0" junit_version = "4.13.1" - oltu_version = "1.0.1" + scribejava_version = "8.0.0" } dependencies { @@ -156,7 +132,8 @@ dependencies { {{#threetenbp}} implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" {{/threetenbp}} - implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" + implementation "com.brsanthu:migbase64:2.2" + implementation "com.github.scribejava:scribejava-core:$scribejava_version" implementation "com.brsanthu:migbase64:2.2" implementation 'javax.annotation:javax.annotation-api:1.3.2' testImplementation "junit:junit:$junit_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache index 322abb2a5cb..218469b0d57 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache @@ -19,7 +19,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "2.9.10" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", - "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", "junit" % "junit" % "4.13.1" % "test", diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache index e9abe7dbaad..ce830af9e11 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache @@ -161,17 +161,7 @@ 3.1.1 none - {{#supportJava6}} - 1.6 - {{/supportJava6}} - {{^supportJava6}} - {{#java8}} - 1.8 - {{/java8}} - {{^java8}} - 1.7 - {{/java8}} - {{/supportJava6}} + 1.8 @@ -282,40 +272,38 @@ {{/openApiNullable}} {{#withXml}} - - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson-version} - - + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson-version} + {{/withXml}} {{#joda}} - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-version} - + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + {{/joda}} {{#java8}} - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-version} - + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + {{/java8}} {{#threetenbp}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-threetenbp-version} - + + com.github.joschi.jackson + jackson-datatype-threetenbp + ${jackson-threetenbp-version} + {{/threetenbp}} - org.apache.oltu.oauth2 - org.apache.oltu.oauth2.client - ${oltu-version} + com.github.scribejava + scribejava-core + ${scribejava-version} javax.annotation @@ -346,7 +334,7 @@ UTF-8 - {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}} + 1.8 ${java.version} ${java.version} 1.5.24 @@ -363,6 +351,6 @@ 1.3.2 4.13.1 1.0.0 - 1.0.1 + 8.0.0 diff --git a/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES b/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES index 1e341310444..cd394fffa07 100644 --- a/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES +++ b/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES @@ -28,10 +28,13 @@ src/main/java/org/openapitools/client/api/PetApi.java src/main/java/org/openapitools/client/api/StoreApi.java src/main/java/org/openapitools/client/api/UserApi.java src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/auth/OAuth.java src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java +src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java diff --git a/samples/client/petstore/java/feign-no-nullable/README.md b/samples/client/petstore/java/feign-no-nullable/README.md index 86ec963c508..8a2d579d815 100644 --- a/samples/client/petstore/java/feign-no-nullable/README.md +++ b/samples/client/petstore/java/feign-no-nullable/README.md @@ -32,6 +32,41 @@ After the client library is installed/deployed, you can use it in your Maven pro ``` +And to use the api you can follow the examples bellow: + +```java + + //Set bearer token manually + ApiClient apiClient = new ApiClient("petstore_auth_client"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setAccessToken("TOKEN", 10000); + + //Use api key + ApiClient apiClient = new ApiClient("api_key", "API KEY"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + + //Use http basic authentication + ApiClient apiClient = new ApiClient("basicAuth"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setCredentials("username", "password"); + + //Oauth password + ApiClient apiClient = new ApiClient("oauth_password"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setOauthPassword("username", "password", "client_id", "client_secret"); + + //Oauth client credentials flow + ApiClient apiClient = new ApiClient("oauth_client_credentials"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setClientCredentials("client_id", "client_secret"); + + PetApi petApi = apiClient.buildClient(PetApi.class); + Pet petById = petApi.getPetById(12345L); + + System.out.println(petById); + } +``` + ## Recommendation It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. @@ -40,4 +75,3 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea - diff --git a/samples/client/petstore/java/feign-no-nullable/build.gradle b/samples/client/petstore/java/feign-no-nullable/build.gradle index 714dcc365b1..69082b38baf 100644 --- a/samples/client/petstore/java/feign-no-nullable/build.gradle +++ b/samples/client/petstore/java/feign-no-nullable/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -79,8 +79,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { @@ -102,7 +102,7 @@ ext { feign_version = "10.11" feign_form_version = "3.8.0" junit_version = "4.13.1" - oltu_version = "1.0.1" + scribejava_version = "8.0.0" } dependencies { @@ -116,7 +116,8 @@ dependencies { implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" - implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" + implementation "com.brsanthu:migbase64:2.2" + implementation "com.github.scribejava:scribejava-core:$scribejava_version" implementation "com.brsanthu:migbase64:2.2" implementation 'javax.annotation:javax.annotation-api:1.3.2' testImplementation "junit:junit:$junit_version" diff --git a/samples/client/petstore/java/feign-no-nullable/build.sbt b/samples/client/petstore/java/feign-no-nullable/build.sbt index e2f16203405..89fe08d2939 100644 --- a/samples/client/petstore/java/feign-no-nullable/build.sbt +++ b/samples/client/petstore/java/feign-no-nullable/build.sbt @@ -19,7 +19,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", - "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", "junit" % "junit" % "4.13.1" % "test", diff --git a/samples/client/petstore/java/feign-no-nullable/pom.xml b/samples/client/petstore/java/feign-no-nullable/pom.xml index 21d57629126..a0d99f21447 100644 --- a/samples/client/petstore/java/feign-no-nullable/pom.xml +++ b/samples/client/petstore/java/feign-no-nullable/pom.xml @@ -154,7 +154,7 @@ 3.1.1 none - 1.7 + 1.8 @@ -257,15 +257,15 @@ jackson-databind ${jackson-databind-version} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-threetenbp-version} - - org.apache.oltu.oauth2 - org.apache.oltu.oauth2.client - ${oltu-version} + com.github.joschi.jackson + jackson-datatype-threetenbp + ${jackson-threetenbp-version} + + + com.github.scribejava + scribejava-core + ${scribejava-version} javax.annotation @@ -296,7 +296,7 @@ UTF-8 - 1.7 + 1.8 ${java.version} ${java.version} 1.5.24 @@ -308,6 +308,6 @@ 1.3.2 4.13.1 1.0.0 - 1.0.1 + 8.0.0 diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java index 69315cfc70c..87b9f7bbe27 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java @@ -2,9 +2,8 @@ package org.openapitools.client; import java.util.LinkedHashMap; import java.util.Map; - -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import java.util.logging.Level; +import java.util.logging.Logger; import org.threeten.bp.*; @@ -24,6 +23,8 @@ import org.openapitools.client.auth.OAuth.AccessTokenListener; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiClient { + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + public interface Api {} protected ObjectMapper objectMapper; @@ -43,6 +44,7 @@ public class ApiClient { public ApiClient(String[] authNames) { this(); for(String authName : authNames) { + log.log(Level.FINE, "Creating authentication {0}", authName); RequestInterceptor auth; if ("api_key".equals(authName)) { auth = new ApiKeyAuth("header", "api_key"); @@ -51,7 +53,7 @@ public class ApiClient { } else if ("http_basic_test".equals(authName)) { auth = new HttpBasicAuth(); } else if ("petstore_auth".equals(authName)) { - auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); + auth = buildOauthRequestInterceptor(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } @@ -77,34 +79,6 @@ public class ApiClient { this.setApiKey(apiKey); } - /** - * Helper constructor for single basic auth or password oauth2 - * @param authName - * @param username - * @param password - */ - public ApiClient(String authName, String username, String password) { - this(authName); - this.setCredentials(username, password); - } - - /** - * Helper constructor for single password oauth2 - * @param authName - * @param clientId - * @param secret - * @param username - * @param password - */ - public ApiClient(String authName, String clientId, String secret, String username, String password) { - this(authName); - this.getTokenEndPoint() - .setClientId(clientId) - .setClientSecret(secret) - .setUsername(username) - .setPassword(password); - } - public String getBasePath() { return basePath; } @@ -147,10 +121,25 @@ public class ApiClient { return objectMapper; } + private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { + switch (flow) { + case password: + return new OauthPasswordGrant(tokenUrl, scopes); + case application: + return new OauthClientCredentialsGrant(authorizationUrl, tokenUrl, scopes); + default: + throw new RuntimeException("Oauth flow \"" + flow + "\" is not implemented"); + } + } + public ObjectMapper getObjectMapper(){ return objectMapper; } + public void setObjectMapper(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + /** * Creates a feign client for given API interface. * @@ -197,19 +186,13 @@ public class ApiClient { return contentTypes[0]; } - /** * Helper method to configure the bearer token. * @param bearerToken the bearer token. */ public void setBearerToken(String bearerToken) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof HttpBearerAuth) { - ((HttpBearerAuth) apiAuthorization).setBearerToken(bearerToken); - return; - } - } - throw new RuntimeException("No Bearer authentication configured!"); + HttpBearerAuth apiAuthorization = getAuthorization(HttpBearerAuth.class); + apiAuthorization.setBearerToken(bearerToken); } /** @@ -217,63 +200,38 @@ public class ApiClient { * @param apiKey API key */ public void setApiKey(String apiKey) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof ApiKeyAuth) { - ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization; - keyAuth.setApiKey(apiKey); - return ; - } - } - throw new RuntimeException("No API key authentication configured!"); + ApiKeyAuth apiAuthorization = getAuthorization(ApiKeyAuth.class); + apiAuthorization.setApiKey(apiKey); } /** - * Helper method to configure the username/password for basic auth or password OAuth + * Helper method to configure the username/password for basic auth * @param username Username * @param password Password */ public void setCredentials(String username, String password) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof HttpBasicAuth) { - HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization; - basicAuth.setCredentials(username, password); - return; - } - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.getTokenRequestBuilder().setUsername(username).setPassword(password); - return; - } - } - throw new RuntimeException("No Basic authentication or OAuth configured!"); + HttpBasicAuth apiAuthorization = getAuthorization(HttpBasicAuth.class); + apiAuthorization.setCredentials(username, password); } /** - * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Token request builder + * Helper method to configure the client credentials for Oauth + * @param username Username + * @param password Password */ - public TokenRequestBuilder getTokenEndPoint() { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - return oauth.getTokenRequestBuilder(); - } - } - return null; + public void setClientCredentials(String clientId, String clientSecret) { + OauthClientCredentialsGrant authorization = getAuthorization(OauthClientCredentialsGrant.class); + authorization.configure(clientId, clientSecret); } /** - * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Authentication request builder + * Helper method to configure the username/password for Oauth password grant + * @param username Username + * @param password Password */ - public AuthenticationRequestBuilder getAuthorizationEndPoint() { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - return oauth.getAuthenticationRequestBuilder(); - } - } - return null; + public void setOauthPassword(String username, String password, String clientId, String clientSecret) { + OauthPasswordGrant apiAuthorization = getAuthorization(OauthPasswordGrant.class); + apiAuthorization.configure(username, password, clientId, clientSecret); } /** @@ -281,14 +239,9 @@ public class ApiClient { * @param accessToken Access Token * @param expiresIn Validity period in seconds */ - public void setAccessToken(String accessToken, Long expiresIn) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.setAccessToken(accessToken, expiresIn); - return; - } - } + public void setAccessToken(String accessToken, Integer expiresIn) { + OAuth apiAuthorization = getAuthorization(OAuth.class); + apiAuthorization.setAccessToken(accessToken, expiresIn); } /** @@ -298,19 +251,7 @@ public class ApiClient { * @param redirectURI Redirect URI */ public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.getTokenRequestBuilder() - .setClientId(clientId) - .setClientSecret(clientSecret) - .setRedirectURI(redirectURI); - oauth.getAuthenticationRequestBuilder() - .setClientId(clientId) - .setRedirectURI(redirectURI); - return; - } - } + throw new RuntimeException("Not implemented"); } /** @@ -318,13 +259,8 @@ public class ApiClient { * @param accessTokenListener Acesss token listener */ public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.registerAccessTokenListener(accessTokenListener); - return; - } - } + OAuth apiAuthorization = getAuthorization(OAuth.class); + apiAuthorization.registerAccessTokenListener(accessTokenListener); } /** @@ -349,4 +285,11 @@ public class ApiClient { feignBuilder.requestInterceptor(authorization); } + private T getAuthorization(Class type) { + return (T) apiAuthorizations.values() + .stream() + .filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass())) + .findFirst() + .orElseThrow(() -> new RuntimeException("No Oauth authentication or OAuth configured!")); + } } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java new file mode 100644 index 00000000000..80db21111f9 --- /dev/null +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java @@ -0,0 +1,47 @@ +package org.openapitools.client.auth; + +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor; +import com.github.scribejava.core.extractors.TokenExtractor; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth2.bearersignature.BearerSignature; +import com.github.scribejava.core.oauth2.bearersignature.BearerSignatureURIQueryParameter; +import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; +import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DefaultApi20Impl extends DefaultApi20 { + + private final String accessTokenEndpoint; + private final String authorizationBaseUrl; + + protected DefaultApi20Impl(String authorizationBaseUrl, String accessTokenEndpoint) { + this.authorizationBaseUrl = authorizationBaseUrl; + this.accessTokenEndpoint = accessTokenEndpoint; + } + + @Override + public String getAccessTokenEndpoint() { + return accessTokenEndpoint; + } + + @Override + protected String getAuthorizationBaseUrl() { + return authorizationBaseUrl; + } + + @Override + public BearerSignature getBearerSignature() { + return BearerSignatureURIQueryParameter.instance(); + } + + @Override + public ClientAuthentication getClientAuthentication() { + return RequestBodyAuthenticationScheme.instance(); + } + + @Override + public TokenExtractor getAccessTokenExtractor() { + return OAuth2AccessTokenJsonExtractor.instance(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OAuth.java index f59ad4a94ba..d41eca7a0a5 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OAuth.java @@ -1,198 +1,81 @@ package org.openapitools.client.auth; -import java.io.IOException; -import java.util.Collection; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.oltu.oauth2.client.HttpClient; -import org.apache.oltu.oauth2.client.OAuthClient; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; -import org.apache.oltu.oauth2.client.response.OAuthClientResponse; -import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; -import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; -import org.apache.oltu.oauth2.common.exception.OAuthProblemException; -import org.apache.oltu.oauth2.common.exception.OAuthSystemException; -import org.apache.oltu.oauth2.common.message.types.GrantType; -import org.apache.oltu.oauth2.common.token.BasicOAuthToken; - -import feign.Client; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth.OAuth20Service; import feign.Request.HttpMethod; -import feign.Request.Options; import feign.RequestInterceptor; import feign.RequestTemplate; -import feign.Response; import feign.RetryableException; -import feign.Util; -import org.openapitools.client.StringUtil; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public abstract class OAuth implements RequestInterceptor { -public class OAuth implements RequestInterceptor { + static final int MILLIS_PER_SECOND = 1000; - static final int MILLIS_PER_SECOND = 1000; + public interface AccessTokenListener { + void notify(OAuth2AccessToken token); + } - public interface AccessTokenListener { - void notify(BasicOAuthToken token); + private volatile String accessToken; + private Long expirationTimeMillis; + private AccessTokenListener accessTokenListener; + + protected OAuth20Service service; + protected String scopes; + protected String authorizationUrl; + protected String tokenUrl; + + public OAuth(String authorizationUrl, String tokenUrl, String scopes) { + this.scopes = scopes; + this.authorizationUrl = authorizationUrl; + this.tokenUrl = tokenUrl; + } + + @Override + public void apply(RequestTemplate template) { + // If the request already have an authorization (eg. Basic auth), do nothing + if (template.headers().containsKey("Authorization")) { + return; } - - private volatile String accessToken; - private Long expirationTimeMillis; - private OAuthClient oauthClient; - private TokenRequestBuilder tokenRequestBuilder; - private AuthenticationRequestBuilder authenticationRequestBuilder; - private AccessTokenListener accessTokenListener; - - public OAuth(Client client, TokenRequestBuilder requestBuilder) { - this.oauthClient = new OAuthClient(new OAuthFeignClient(client)); - this.tokenRequestBuilder = requestBuilder; + // If first time, get the token + if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) { + updateAccessToken(template); } - - public OAuth(Client client, OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { - this(client, OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes)); - - switch(flow) { - case accessCode: - case implicit: - tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); - break; - case password: - tokenRequestBuilder.setGrantType(GrantType.PASSWORD); - break; - case application: - tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); - break; - default: - break; - } - authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl); + if (getAccessToken() != null) { + template.header("Authorization", "Bearer " + getAccessToken()); } + } - public OAuth(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { - this(new Client.Default(null, null), flow, authorizationUrl, tokenUrl, scopes); + private synchronized void updateAccessToken(RequestTemplate template) { + OAuth2AccessToken accessTokenResponse; + try { + accessTokenResponse = getOAuth2AccessToken(); + } catch (Exception e) { + throw new RetryableException(0, e.getMessage(), HttpMethod.POST, e, null, template.request()); } - - @Override - public void apply(RequestTemplate template) { - // If the request already have an authorization (eg. Basic auth), do nothing - if (template.headers().containsKey("Authorization")) { - return; - } - // If first time, get the token - if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) { - updateAccessToken(template); - } - if (getAccessToken() != null) { - template.header("Authorization", "Bearer " + getAccessToken()); - } + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn()); + if (accessTokenListener != null) { + accessTokenListener.notify(accessTokenResponse); + } } + } - public synchronized void updateAccessToken(RequestTemplate template) { - OAuthJSONAccessTokenResponse accessTokenResponse; - try { - accessTokenResponse = oauthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); - } catch (Exception e) { - throw new RetryableException(0, e.getMessage(), HttpMethod.POST, e, null, template.request()); - } - if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { - setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn()); - if (accessTokenListener != null) { - accessTokenListener.notify((BasicOAuthToken) accessTokenResponse.getOAuthToken()); - } - } - } + abstract OAuth2AccessToken getOAuth2AccessToken(); - public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - this.accessTokenListener = accessTokenListener; - } + abstract OAuthFlow getFlow(); - public synchronized String getAccessToken() { - return accessToken; - } + public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) { + this.accessTokenListener = accessTokenListener; + } - public synchronized void setAccessToken(String accessToken, Long expiresIn) { - this.accessToken = accessToken; - this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND; - } + public synchronized String getAccessToken() { + return accessToken; + } - public TokenRequestBuilder getTokenRequestBuilder() { - return tokenRequestBuilder; - } + public synchronized void setAccessToken(String accessToken, Integer expiresIn) { + this.accessToken = accessToken; + this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND; + } - public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { - this.tokenRequestBuilder = tokenRequestBuilder; - } - - public AuthenticationRequestBuilder getAuthenticationRequestBuilder() { - return authenticationRequestBuilder; - } - - public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) { - this.authenticationRequestBuilder = authenticationRequestBuilder; - } - - public OAuthClient getOauthClient() { - return oauthClient; - } - - public void setOauthClient(OAuthClient oauthClient) { - this.oauthClient = oauthClient; - } - - public void setOauthClient(Client client) { - this.oauthClient = new OAuthClient( new OAuthFeignClient(client)); - } - - public static class OAuthFeignClient implements HttpClient { - - private Client client; - - public OAuthFeignClient() { - this.client = new Client.Default(null, null); - } - - public OAuthFeignClient(Client client) { - this.client = client; - } - - public T execute(OAuthClientRequest request, Map headers, - String requestMethod, Class responseClass) - throws OAuthSystemException, OAuthProblemException { - - RequestTemplate req = new RequestTemplate() - .append(request.getLocationUri()) - .method(requestMethod) - .body(request.getBody()); - - for (Entry entry : headers.entrySet()) { - req.header(entry.getKey(), entry.getValue()); - } - Response feignResponse; - String body = ""; - try { - feignResponse = client.execute(req.request(), new Options()); - body = Util.toString(feignResponse.body().asReader()); - } catch (IOException e) { - throw new OAuthSystemException(e); - } - - String contentType = null; - Collection contentTypeHeader = feignResponse.headers().get("Content-Type"); - if(contentTypeHeader != null) { - contentType = StringUtil.join(contentTypeHeader.toArray(new String[0]), ";"); - } - - return OAuthClientResponseFactory.createCustomResponse( - body, - contentType, - feignResponse.status(), - responseClass - ); - } - - public void shutdown() { - // Nothing to do here - } - } -} +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OAuthFlow.java index b2d11ff0c4f..75c2a0c9740 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -13,6 +13,10 @@ package org.openapitools.client.auth; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, //called authorizationCode in OpenAPI 3.0 + implicit, + password, + application //called clientCredentials in OpenAPI 3.0 } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java new file mode 100644 index 00000000000..a21c5a15ba2 --- /dev/null +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java @@ -0,0 +1,39 @@ +package org.openapitools.client.auth; + +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth2AccessToken; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OauthClientCredentialsGrant extends OAuth { + + public OauthClientCredentialsGrant(String authorizationUrl, String tokenUrl, String scopes) { + super(authorizationUrl, tokenUrl, scopes); + } + + @Override + protected OAuth2AccessToken getOAuth2AccessToken() { + try { + return service.getAccessTokenClientCredentialsGrant(scopes); + } catch (Exception e) { + throw new RuntimeException("Failed to get oauth token", e); + } + } + + @Override + protected OAuthFlow getFlow() { + return OAuthFlow.application; + } + + /** + * Configures the client credentials flow + * + * @param clientId + * @param clientSecret + */ + public void configure(String clientId, String clientSecret) { + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .defaultScope(scopes) + .build(new DefaultApi20Impl(authorizationUrl, tokenUrl)); + } +} diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java new file mode 100644 index 00000000000..dba4fb3a076 --- /dev/null +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java @@ -0,0 +1,48 @@ +package org.openapitools.client.auth; + +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth2AccessToken; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OauthPasswordGrant extends OAuth { + + private String username; + private String password; + + public OauthPasswordGrant(String tokenUrl, String scopes) { + super(null, tokenUrl, scopes); + } + + @Override + protected OAuth2AccessToken getOAuth2AccessToken() { + try { + return service.getAccessTokenPasswordGrant(username, password); + } catch (Exception e) { + throw new RuntimeException("Failed to get oauth token", e); + } + } + + @Override + protected OAuthFlow getFlow() { + return OAuthFlow.password; + } + + /** + * Configures Oauth password grant flow + * Note: this flow is deprecated. + * + * @param username + * @param password + * @param clientId + * @param clientSecret + */ + public void configure(String username, String password, String clientId, String clientSecret) { + this.username = username; + this.password = password; + //TODO the clientId and secret are optional according with the RFC + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .defaultScope(scopes) + .build(new DefaultApi20Impl(authorizationUrl, tokenUrl)); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign/.openapi-generator/FILES b/samples/client/petstore/java/feign/.openapi-generator/FILES index 1e341310444..cd394fffa07 100644 --- a/samples/client/petstore/java/feign/.openapi-generator/FILES +++ b/samples/client/petstore/java/feign/.openapi-generator/FILES @@ -28,10 +28,13 @@ src/main/java/org/openapitools/client/api/PetApi.java src/main/java/org/openapitools/client/api/StoreApi.java src/main/java/org/openapitools/client/api/UserApi.java src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/auth/OAuth.java src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java +src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java diff --git a/samples/client/petstore/java/feign/README.md b/samples/client/petstore/java/feign/README.md index 646dfdc4e2b..fa5dd565da4 100644 --- a/samples/client/petstore/java/feign/README.md +++ b/samples/client/petstore/java/feign/README.md @@ -32,6 +32,41 @@ After the client library is installed/deployed, you can use it in your Maven pro ``` +And to use the api you can follow the examples bellow: + +```java + + //Set bearer token manually + ApiClient apiClient = new ApiClient("petstore_auth_client"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setAccessToken("TOKEN", 10000); + + //Use api key + ApiClient apiClient = new ApiClient("api_key", "API KEY"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + + //Use http basic authentication + ApiClient apiClient = new ApiClient("basicAuth"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setCredentials("username", "password"); + + //Oauth password + ApiClient apiClient = new ApiClient("oauth_password"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setOauthPassword("username", "password", "client_id", "client_secret"); + + //Oauth client credentials flow + ApiClient apiClient = new ApiClient("oauth_client_credentials"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setClientCredentials("client_id", "client_secret"); + + PetApi petApi = apiClient.buildClient(PetApi.class); + Pet petById = petApi.getPetById(12345L); + + System.out.println(petById); + } +``` + ## Recommendation It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. @@ -40,4 +75,3 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea - diff --git a/samples/client/petstore/java/feign/build.gradle b/samples/client/petstore/java/feign/build.gradle index 8e51bb4bfd9..637b0f9d649 100644 --- a/samples/client/petstore/java/feign/build.gradle +++ b/samples/client/petstore/java/feign/build.gradle @@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -79,8 +79,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { @@ -103,7 +103,7 @@ ext { feign_version = "10.11" feign_form_version = "3.8.0" junit_version = "4.13.1" - oltu_version = "1.0.1" + scribejava_version = "8.0.0" } dependencies { @@ -118,7 +118,8 @@ dependencies { implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" - implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" + implementation "com.brsanthu:migbase64:2.2" + implementation "com.github.scribejava:scribejava-core:$scribejava_version" implementation "com.brsanthu:migbase64:2.2" implementation 'javax.annotation:javax.annotation-api:1.3.2' testImplementation "junit:junit:$junit_version" diff --git a/samples/client/petstore/java/feign/build.sbt b/samples/client/petstore/java/feign/build.sbt index 1af0ed0153a..a2783502176 100644 --- a/samples/client/petstore/java/feign/build.sbt +++ b/samples/client/petstore/java/feign/build.sbt @@ -19,7 +19,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", - "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", "junit" % "junit" % "4.13.1" % "test", diff --git a/samples/client/petstore/java/feign/pom.xml b/samples/client/petstore/java/feign/pom.xml index b7a9b1f4be8..b3b36a2077a 100644 --- a/samples/client/petstore/java/feign/pom.xml +++ b/samples/client/petstore/java/feign/pom.xml @@ -154,7 +154,7 @@ 3.1.1 none - 1.7 + 1.8 @@ -262,15 +262,15 @@ jackson-databind-nullable ${jackson-databind-nullable-version} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-threetenbp-version} - - org.apache.oltu.oauth2 - org.apache.oltu.oauth2.client - ${oltu-version} + com.github.joschi.jackson + jackson-datatype-threetenbp + ${jackson-threetenbp-version} + + + com.github.scribejava + scribejava-core + ${scribejava-version} javax.annotation @@ -301,7 +301,7 @@ UTF-8 - 1.7 + 1.8 ${java.version} ${java.version} 1.5.24 @@ -314,6 +314,6 @@ 1.3.2 4.13.1 1.0.0 - 1.0.1 + 8.0.0 diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java index 4e256daf6b2..87d97bddee8 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java @@ -2,9 +2,8 @@ package org.openapitools.client; import java.util.LinkedHashMap; import java.util.Map; - -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import java.util.logging.Level; +import java.util.logging.Logger; import org.threeten.bp.*; @@ -25,6 +24,8 @@ import org.openapitools.client.auth.OAuth.AccessTokenListener; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiClient { + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + public interface Api {} protected ObjectMapper objectMapper; @@ -44,6 +45,7 @@ public class ApiClient { public ApiClient(String[] authNames) { this(); for(String authName : authNames) { + log.log(Level.FINE, "Creating authentication {0}", authName); RequestInterceptor auth; if ("api_key".equals(authName)) { auth = new ApiKeyAuth("header", "api_key"); @@ -52,7 +54,7 @@ public class ApiClient { } else if ("http_basic_test".equals(authName)) { auth = new HttpBasicAuth(); } else if ("petstore_auth".equals(authName)) { - auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); + auth = buildOauthRequestInterceptor(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } @@ -78,34 +80,6 @@ public class ApiClient { this.setApiKey(apiKey); } - /** - * Helper constructor for single basic auth or password oauth2 - * @param authName - * @param username - * @param password - */ - public ApiClient(String authName, String username, String password) { - this(authName); - this.setCredentials(username, password); - } - - /** - * Helper constructor for single password oauth2 - * @param authName - * @param clientId - * @param secret - * @param username - * @param password - */ - public ApiClient(String authName, String clientId, String secret, String username, String password) { - this(authName); - this.getTokenEndPoint() - .setClientId(clientId) - .setClientSecret(secret) - .setUsername(username) - .setPassword(password); - } - public String getBasePath() { return basePath; } @@ -150,10 +124,25 @@ public class ApiClient { return objectMapper; } + private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { + switch (flow) { + case password: + return new OauthPasswordGrant(tokenUrl, scopes); + case application: + return new OauthClientCredentialsGrant(authorizationUrl, tokenUrl, scopes); + default: + throw new RuntimeException("Oauth flow \"" + flow + "\" is not implemented"); + } + } + public ObjectMapper getObjectMapper(){ return objectMapper; } + public void setObjectMapper(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + /** * Creates a feign client for given API interface. * @@ -200,19 +189,13 @@ public class ApiClient { return contentTypes[0]; } - /** * Helper method to configure the bearer token. * @param bearerToken the bearer token. */ public void setBearerToken(String bearerToken) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof HttpBearerAuth) { - ((HttpBearerAuth) apiAuthorization).setBearerToken(bearerToken); - return; - } - } - throw new RuntimeException("No Bearer authentication configured!"); + HttpBearerAuth apiAuthorization = getAuthorization(HttpBearerAuth.class); + apiAuthorization.setBearerToken(bearerToken); } /** @@ -220,63 +203,38 @@ public class ApiClient { * @param apiKey API key */ public void setApiKey(String apiKey) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof ApiKeyAuth) { - ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization; - keyAuth.setApiKey(apiKey); - return ; - } - } - throw new RuntimeException("No API key authentication configured!"); + ApiKeyAuth apiAuthorization = getAuthorization(ApiKeyAuth.class); + apiAuthorization.setApiKey(apiKey); } /** - * Helper method to configure the username/password for basic auth or password OAuth + * Helper method to configure the username/password for basic auth * @param username Username * @param password Password */ public void setCredentials(String username, String password) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof HttpBasicAuth) { - HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization; - basicAuth.setCredentials(username, password); - return; - } - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.getTokenRequestBuilder().setUsername(username).setPassword(password); - return; - } - } - throw new RuntimeException("No Basic authentication or OAuth configured!"); + HttpBasicAuth apiAuthorization = getAuthorization(HttpBasicAuth.class); + apiAuthorization.setCredentials(username, password); } /** - * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Token request builder + * Helper method to configure the client credentials for Oauth + * @param username Username + * @param password Password */ - public TokenRequestBuilder getTokenEndPoint() { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - return oauth.getTokenRequestBuilder(); - } - } - return null; + public void setClientCredentials(String clientId, String clientSecret) { + OauthClientCredentialsGrant authorization = getAuthorization(OauthClientCredentialsGrant.class); + authorization.configure(clientId, clientSecret); } /** - * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Authentication request builder + * Helper method to configure the username/password for Oauth password grant + * @param username Username + * @param password Password */ - public AuthenticationRequestBuilder getAuthorizationEndPoint() { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - return oauth.getAuthenticationRequestBuilder(); - } - } - return null; + public void setOauthPassword(String username, String password, String clientId, String clientSecret) { + OauthPasswordGrant apiAuthorization = getAuthorization(OauthPasswordGrant.class); + apiAuthorization.configure(username, password, clientId, clientSecret); } /** @@ -284,14 +242,9 @@ public class ApiClient { * @param accessToken Access Token * @param expiresIn Validity period in seconds */ - public void setAccessToken(String accessToken, Long expiresIn) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.setAccessToken(accessToken, expiresIn); - return; - } - } + public void setAccessToken(String accessToken, Integer expiresIn) { + OAuth apiAuthorization = getAuthorization(OAuth.class); + apiAuthorization.setAccessToken(accessToken, expiresIn); } /** @@ -301,19 +254,7 @@ public class ApiClient { * @param redirectURI Redirect URI */ public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.getTokenRequestBuilder() - .setClientId(clientId) - .setClientSecret(clientSecret) - .setRedirectURI(redirectURI); - oauth.getAuthenticationRequestBuilder() - .setClientId(clientId) - .setRedirectURI(redirectURI); - return; - } - } + throw new RuntimeException("Not implemented"); } /** @@ -321,13 +262,8 @@ public class ApiClient { * @param accessTokenListener Acesss token listener */ public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.registerAccessTokenListener(accessTokenListener); - return; - } - } + OAuth apiAuthorization = getAuthorization(OAuth.class); + apiAuthorization.registerAccessTokenListener(accessTokenListener); } /** @@ -352,4 +288,11 @@ public class ApiClient { feignBuilder.requestInterceptor(authorization); } + private T getAuthorization(Class type) { + return (T) apiAuthorizations.values() + .stream() + .filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass())) + .findFirst() + .orElseThrow(() -> new RuntimeException("No Oauth authentication or OAuth configured!")); + } } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java new file mode 100644 index 00000000000..80db21111f9 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java @@ -0,0 +1,47 @@ +package org.openapitools.client.auth; + +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor; +import com.github.scribejava.core.extractors.TokenExtractor; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth2.bearersignature.BearerSignature; +import com.github.scribejava.core.oauth2.bearersignature.BearerSignatureURIQueryParameter; +import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; +import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DefaultApi20Impl extends DefaultApi20 { + + private final String accessTokenEndpoint; + private final String authorizationBaseUrl; + + protected DefaultApi20Impl(String authorizationBaseUrl, String accessTokenEndpoint) { + this.authorizationBaseUrl = authorizationBaseUrl; + this.accessTokenEndpoint = accessTokenEndpoint; + } + + @Override + public String getAccessTokenEndpoint() { + return accessTokenEndpoint; + } + + @Override + protected String getAuthorizationBaseUrl() { + return authorizationBaseUrl; + } + + @Override + public BearerSignature getBearerSignature() { + return BearerSignatureURIQueryParameter.instance(); + } + + @Override + public ClientAuthentication getClientAuthentication() { + return RequestBodyAuthenticationScheme.instance(); + } + + @Override + public TokenExtractor getAccessTokenExtractor() { + return OAuth2AccessTokenJsonExtractor.instance(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OAuth.java index f59ad4a94ba..d41eca7a0a5 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OAuth.java @@ -1,198 +1,81 @@ package org.openapitools.client.auth; -import java.io.IOException; -import java.util.Collection; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.oltu.oauth2.client.HttpClient; -import org.apache.oltu.oauth2.client.OAuthClient; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; -import org.apache.oltu.oauth2.client.response.OAuthClientResponse; -import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; -import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; -import org.apache.oltu.oauth2.common.exception.OAuthProblemException; -import org.apache.oltu.oauth2.common.exception.OAuthSystemException; -import org.apache.oltu.oauth2.common.message.types.GrantType; -import org.apache.oltu.oauth2.common.token.BasicOAuthToken; - -import feign.Client; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth.OAuth20Service; import feign.Request.HttpMethod; -import feign.Request.Options; import feign.RequestInterceptor; import feign.RequestTemplate; -import feign.Response; import feign.RetryableException; -import feign.Util; -import org.openapitools.client.StringUtil; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public abstract class OAuth implements RequestInterceptor { -public class OAuth implements RequestInterceptor { + static final int MILLIS_PER_SECOND = 1000; - static final int MILLIS_PER_SECOND = 1000; + public interface AccessTokenListener { + void notify(OAuth2AccessToken token); + } - public interface AccessTokenListener { - void notify(BasicOAuthToken token); + private volatile String accessToken; + private Long expirationTimeMillis; + private AccessTokenListener accessTokenListener; + + protected OAuth20Service service; + protected String scopes; + protected String authorizationUrl; + protected String tokenUrl; + + public OAuth(String authorizationUrl, String tokenUrl, String scopes) { + this.scopes = scopes; + this.authorizationUrl = authorizationUrl; + this.tokenUrl = tokenUrl; + } + + @Override + public void apply(RequestTemplate template) { + // If the request already have an authorization (eg. Basic auth), do nothing + if (template.headers().containsKey("Authorization")) { + return; } - - private volatile String accessToken; - private Long expirationTimeMillis; - private OAuthClient oauthClient; - private TokenRequestBuilder tokenRequestBuilder; - private AuthenticationRequestBuilder authenticationRequestBuilder; - private AccessTokenListener accessTokenListener; - - public OAuth(Client client, TokenRequestBuilder requestBuilder) { - this.oauthClient = new OAuthClient(new OAuthFeignClient(client)); - this.tokenRequestBuilder = requestBuilder; + // If first time, get the token + if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) { + updateAccessToken(template); } - - public OAuth(Client client, OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { - this(client, OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes)); - - switch(flow) { - case accessCode: - case implicit: - tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); - break; - case password: - tokenRequestBuilder.setGrantType(GrantType.PASSWORD); - break; - case application: - tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); - break; - default: - break; - } - authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl); + if (getAccessToken() != null) { + template.header("Authorization", "Bearer " + getAccessToken()); } + } - public OAuth(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { - this(new Client.Default(null, null), flow, authorizationUrl, tokenUrl, scopes); + private synchronized void updateAccessToken(RequestTemplate template) { + OAuth2AccessToken accessTokenResponse; + try { + accessTokenResponse = getOAuth2AccessToken(); + } catch (Exception e) { + throw new RetryableException(0, e.getMessage(), HttpMethod.POST, e, null, template.request()); } - - @Override - public void apply(RequestTemplate template) { - // If the request already have an authorization (eg. Basic auth), do nothing - if (template.headers().containsKey("Authorization")) { - return; - } - // If first time, get the token - if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) { - updateAccessToken(template); - } - if (getAccessToken() != null) { - template.header("Authorization", "Bearer " + getAccessToken()); - } + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn()); + if (accessTokenListener != null) { + accessTokenListener.notify(accessTokenResponse); + } } + } - public synchronized void updateAccessToken(RequestTemplate template) { - OAuthJSONAccessTokenResponse accessTokenResponse; - try { - accessTokenResponse = oauthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); - } catch (Exception e) { - throw new RetryableException(0, e.getMessage(), HttpMethod.POST, e, null, template.request()); - } - if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { - setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn()); - if (accessTokenListener != null) { - accessTokenListener.notify((BasicOAuthToken) accessTokenResponse.getOAuthToken()); - } - } - } + abstract OAuth2AccessToken getOAuth2AccessToken(); - public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - this.accessTokenListener = accessTokenListener; - } + abstract OAuthFlow getFlow(); - public synchronized String getAccessToken() { - return accessToken; - } + public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) { + this.accessTokenListener = accessTokenListener; + } - public synchronized void setAccessToken(String accessToken, Long expiresIn) { - this.accessToken = accessToken; - this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND; - } + public synchronized String getAccessToken() { + return accessToken; + } - public TokenRequestBuilder getTokenRequestBuilder() { - return tokenRequestBuilder; - } + public synchronized void setAccessToken(String accessToken, Integer expiresIn) { + this.accessToken = accessToken; + this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND; + } - public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { - this.tokenRequestBuilder = tokenRequestBuilder; - } - - public AuthenticationRequestBuilder getAuthenticationRequestBuilder() { - return authenticationRequestBuilder; - } - - public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) { - this.authenticationRequestBuilder = authenticationRequestBuilder; - } - - public OAuthClient getOauthClient() { - return oauthClient; - } - - public void setOauthClient(OAuthClient oauthClient) { - this.oauthClient = oauthClient; - } - - public void setOauthClient(Client client) { - this.oauthClient = new OAuthClient( new OAuthFeignClient(client)); - } - - public static class OAuthFeignClient implements HttpClient { - - private Client client; - - public OAuthFeignClient() { - this.client = new Client.Default(null, null); - } - - public OAuthFeignClient(Client client) { - this.client = client; - } - - public T execute(OAuthClientRequest request, Map headers, - String requestMethod, Class responseClass) - throws OAuthSystemException, OAuthProblemException { - - RequestTemplate req = new RequestTemplate() - .append(request.getLocationUri()) - .method(requestMethod) - .body(request.getBody()); - - for (Entry entry : headers.entrySet()) { - req.header(entry.getKey(), entry.getValue()); - } - Response feignResponse; - String body = ""; - try { - feignResponse = client.execute(req.request(), new Options()); - body = Util.toString(feignResponse.body().asReader()); - } catch (IOException e) { - throw new OAuthSystemException(e); - } - - String contentType = null; - Collection contentTypeHeader = feignResponse.headers().get("Content-Type"); - if(contentTypeHeader != null) { - contentType = StringUtil.join(contentTypeHeader.toArray(new String[0]), ";"); - } - - return OAuthClientResponseFactory.createCustomResponse( - body, - contentType, - feignResponse.status(), - responseClass - ); - } - - public void shutdown() { - // Nothing to do here - } - } -} +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OAuthFlow.java index b2d11ff0c4f..75c2a0c9740 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -13,6 +13,10 @@ package org.openapitools.client.auth; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, //called authorizationCode in OpenAPI 3.0 + implicit, + password, + application //called clientCredentials in OpenAPI 3.0 } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java new file mode 100644 index 00000000000..a21c5a15ba2 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java @@ -0,0 +1,39 @@ +package org.openapitools.client.auth; + +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth2AccessToken; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OauthClientCredentialsGrant extends OAuth { + + public OauthClientCredentialsGrant(String authorizationUrl, String tokenUrl, String scopes) { + super(authorizationUrl, tokenUrl, scopes); + } + + @Override + protected OAuth2AccessToken getOAuth2AccessToken() { + try { + return service.getAccessTokenClientCredentialsGrant(scopes); + } catch (Exception e) { + throw new RuntimeException("Failed to get oauth token", e); + } + } + + @Override + protected OAuthFlow getFlow() { + return OAuthFlow.application; + } + + /** + * Configures the client credentials flow + * + * @param clientId + * @param clientSecret + */ + public void configure(String clientId, String clientSecret) { + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .defaultScope(scopes) + .build(new DefaultApi20Impl(authorizationUrl, tokenUrl)); + } +} diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java new file mode 100644 index 00000000000..dba4fb3a076 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java @@ -0,0 +1,48 @@ +package org.openapitools.client.auth; + +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth2AccessToken; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OauthPasswordGrant extends OAuth { + + private String username; + private String password; + + public OauthPasswordGrant(String tokenUrl, String scopes) { + super(null, tokenUrl, scopes); + } + + @Override + protected OAuth2AccessToken getOAuth2AccessToken() { + try { + return service.getAccessTokenPasswordGrant(username, password); + } catch (Exception e) { + throw new RuntimeException("Failed to get oauth token", e); + } + } + + @Override + protected OAuthFlow getFlow() { + return OAuthFlow.password; + } + + /** + * Configures Oauth password grant flow + * Note: this flow is deprecated. + * + * @param username + * @param password + * @param clientId + * @param clientSecret + */ + public void configure(String username, String password, String clientId, String clientSecret) { + this.username = username; + this.password = password; + //TODO the clientId and secret are optional according with the RFC + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .defaultScope(scopes) + .build(new DefaultApi20Impl(authorizationUrl, tokenUrl)); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/auth/OAuthFlow.java index b2d11ff0c4f..75c2a0c9740 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -13,6 +13,10 @@ package org.openapitools.client.auth; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, //called authorizationCode in OpenAPI 3.0 + implicit, + password, + application //called clientCredentials in OpenAPI 3.0 } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java index b2d11ff0c4f..75c2a0c9740 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -13,6 +13,10 @@ package org.openapitools.client.auth; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, //called authorizationCode in OpenAPI 3.0 + implicit, + password, + application //called clientCredentials in OpenAPI 3.0 } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java index b2d11ff0c4f..75c2a0c9740 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -13,6 +13,10 @@ package org.openapitools.client.auth; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, //called authorizationCode in OpenAPI 3.0 + implicit, + password, + application //called clientCredentials in OpenAPI 3.0 } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthFlow.java index b2d11ff0c4f..75c2a0c9740 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -13,6 +13,10 @@ package org.openapitools.client.auth; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, //called authorizationCode in OpenAPI 3.0 + implicit, + password, + application //called clientCredentials in OpenAPI 3.0 } diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/auth/OAuthFlow.java index b2d11ff0c4f..75c2a0c9740 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -13,6 +13,10 @@ package org.openapitools.client.auth; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, //called authorizationCode in OpenAPI 3.0 + implicit, + password, + application //called clientCredentials in OpenAPI 3.0 } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/auth/OAuthFlow.java index b2d11ff0c4f..75c2a0c9740 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -13,6 +13,10 @@ package org.openapitools.client.auth; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, //called authorizationCode in OpenAPI 3.0 + implicit, + password, + application //called clientCredentials in OpenAPI 3.0 } diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/auth/OAuthFlow.java index b2d11ff0c4f..75c2a0c9740 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -13,6 +13,10 @@ package org.openapitools.client.auth; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, //called authorizationCode in OpenAPI 3.0 + implicit, + password, + application //called clientCredentials in OpenAPI 3.0 } diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/auth/OAuthFlow.java index b2d11ff0c4f..75c2a0c9740 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -13,6 +13,10 @@ package org.openapitools.client.auth; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, //called authorizationCode in OpenAPI 3.0 + implicit, + password, + application //called clientCredentials in OpenAPI 3.0 } diff --git a/samples/server/petstore/java-undertow/dependency-reduced-pom.xml b/samples/server/petstore/java-undertow/dependency-reduced-pom.xml index 2c176c4af89..f86a92f3f0a 100644 --- a/samples/server/petstore/java-undertow/dependency-reduced-pom.xml +++ b/samples/server/petstore/java-undertow/dependency-reduced-pom.xml @@ -1,131 +1,131 @@ - - - - oss-parent - org.sonatype.oss - 5 - ../pom.xml/pom.xml - - 4.0.0 - org.openapitools - openapi-undertow-server - openapi-undertow-server - 1.0.0 - - install - target - ${project.artifactId}-${project.version} - - - maven-enforcer-plugin - 3.0.0-M1 - - - enforce-maven - - enforce - - - - - 2.2.0 - - - - - - - - maven-shade-plugin - 2.4.3 - - - package - - shade - - - - - - - - - - - maven-jar-plugin - 2.6 - - - - com.networknt.server.Server - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.4.0 - - java - - -jar - target/${project.build.finalName}.jar - - - - - - - - - sonatype-snapshots - https://oss.sonatype.org/content/repositories/snapshots - - - - - junit - junit - 4.13 - test - - - hamcrest-core - org.hamcrest - - - - - org.apache.httpcomponents - httpclient - 4.5.2 - test - - - - 4.1.2 - 2.9.10.4 - 2.2.0 - 1.10 - 3.1.2 - UTF-8 - 1.2 - 4.5.2 - 1.4.0.Final - 0.5.2 - 2.6 - 1.8 - 2.9.10 - 0.1.1 - 1.5.10 - 2.1.0-beta.124 - 1.7.21 - 2.5 - 1.1.7 - 4.13 - 4.5.3 - - - + + + + oss-parent + org.sonatype.oss + 5 + ../pom.xml/pom.xml + + 4.0.0 + org.openapitools + openapi-undertow-server + openapi-undertow-server + 1.0.0 + + install + target + ${project.artifactId}-${project.version} + + + maven-enforcer-plugin + 3.0.0-M1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + maven-shade-plugin + 2.4.3 + + + package + + shade + + + + + + + + + + + maven-jar-plugin + 2.6 + + + + com.networknt.server.Server + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.4.0 + + java + + -jar + target/${project.build.finalName}.jar + + + + + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + + + + junit + junit + 4.13 + test + + + hamcrest-core + org.hamcrest + + + + + org.apache.httpcomponents + httpclient + 4.5.2 + test + + + + 4.1.2 + 2.9.10.4 + 2.2.0 + 1.10 + 3.1.2 + UTF-8 + 1.2 + 4.5.2 + 1.4.0.Final + 0.5.2 + 2.6 + 1.8 + 2.9.10 + 0.1.1 + 1.5.10 + 2.1.0-beta.124 + 1.7.21 + 2.5 + 1.1.7 + 4.13 + 4.5.3 + + + From f5c49609d2e5c4c2bdf53aeef71347c6a1b3d29c Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Tue, 19 Jan 2021 06:16:20 +0100 Subject: [PATCH 05/54] Javadoc + operations interface + provider for state(ful/less) handlers (#8346) * Added Javadoc + meta-data about request/response + abstract class. * Added one more method to set base path. * Updated Javadoc for each endpoint. * Shorten the method name displayed in Javadoc. * Fix README grammar. * Separate imports based on type. * Put operations into their own interface class. * Update Javadoc. * Adjust Mustache template to support Java 1.5. * Add import for HttpServerExchange, suppress warning about using a Lambda. * Remove @Override from a mgetStatefulHandler(). * Regenrate the samples. --- .../java-undertow-server-java-undertow.yaml | 0 .../languages/JavaUndertowServerCodegen.java | 1 + .../java-undertow-server/README.mustache | 6 +- .../java-undertow-server/bodyParams.mustache | 2 +- .../enumOuterClass.mustache | 4 +- .../generatedAnnotation.mustache | 2 +- .../java-undertow-server/handler.mustache | 165 ++++- .../java-undertow-server/inflector.mustache | 6 +- .../java-undertow-server/interface.mustache | 76 +++ .../isContainerDoc.mustache | 1 + .../java-undertow-server/licenseInfo.mustache | 10 + .../java-undertow-server/model.mustache | 7 +- .../java-undertow-server/pathParams.mustache | 2 +- .../java-undertow-server/pojo.mustache | 26 +- .../java-undertow-server/pom.mustache | 8 +- .../java-undertow-server/queryParams.mustache | 2 +- .../java-undertow/.openapi-generator/FILES | 1 + .../java-undertow/.openapi-generator/VERSION | 2 +- .../server/petstore/java-undertow/README.md | 6 +- .../handler/PathHandlerInterface.java | 604 ++++++++++++++++++ .../handler/PathHandlerProvider.java | 412 ++++++++---- .../java/org/openapitools/model/Category.java | 16 +- .../openapitools/model/ModelApiResponse.java | 18 +- .../java/org/openapitools/model/Order.java | 24 +- .../main/java/org/openapitools/model/Pet.java | 24 +- .../main/java/org/openapitools/model/Tag.java | 16 +- .../java/org/openapitools/model/User.java | 28 +- .../src/main/resources/config/openapi.json | 3 +- 28 files changed, 1239 insertions(+), 233 deletions(-) rename bin/configs/{other => }/java-undertow-server-java-undertow.yaml (100%) create mode 100644 modules/openapi-generator/src/main/resources/java-undertow-server/interface.mustache create mode 100644 modules/openapi-generator/src/main/resources/java-undertow-server/isContainerDoc.mustache create mode 100644 modules/openapi-generator/src/main/resources/java-undertow-server/licenseInfo.mustache create mode 100644 samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java diff --git a/bin/configs/other/java-undertow-server-java-undertow.yaml b/bin/configs/java-undertow-server-java-undertow.yaml similarity index 100% rename from bin/configs/other/java-undertow-server-java-undertow.yaml rename to bin/configs/java-undertow-server-java-undertow.yaml diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java index 384d14d4ca1..92e5d2e1bea 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java @@ -106,6 +106,7 @@ public class JavaUndertowServerCodegen extends AbstractJavaCodegen { // keep the yaml in config folder for framework validation. supportingFiles.add(new SupportingFile("openapi.mustache", ("src.main.resources.config").replace(".", java.io.File.separator), "openapi.json")); + supportingFiles.add(new SupportingFile("interface.mustache", (String.format(Locale.ROOT, "src.main.java.%s", apiPackage)).replace(".", java.io.File.separator), "PathHandlerInterface.java")); supportingFiles.add(new SupportingFile("handler.mustache", (String.format(Locale.ROOT, "src.main.java.%s", apiPackage)).replace(".", java.io.File.separator), "PathHandlerProvider.java")); supportingFiles.add(new SupportingFile("service.mustache", ("src.main.resources.META-INF.services").replace(".", java.io.File.separator), "com.networknt.server.HandlerProvider")); diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/README.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/README.mustache index a983dba343c..f452d35095a 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/README.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/README.mustache @@ -10,15 +10,13 @@ mvn package exec:exec ## Test -By default, all endpoints are protected by OAuth jwt token verifier. It can be turned off with config change through for development. - +By default, all endpoints are protected by the OAuth JWT token verifier. It can be turned off with a config change, when required. In order to access the server, there is a long lived token below issued by my -oauth2 server [undertow-server-oauth2](https://github.com/networknt/undertow-server-oauth2) +OAuth2 server [undertow-server-oauth2](https://github.com/networknt/undertow-server-oauth2). ``` Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJ1cm46Y29tOm5ldHdvcmtudDpvYXV0aDI6djEiLCJhdWQiOiJ1cm46Y29tLm5ldHdvcmtudCIsImV4cCI6MTc4ODEzMjczNSwianRpIjoiNWtyM2ZWOHJaelBZNEJrSnNYZzFpQSIsImlhdCI6MTQ3Mjc3MjczNSwibmJmIjoxNDcyNzcyNjE1LCJ2ZXJzaW9uIjoiMS4wIiwidXNlcl9pZCI6InN0ZXZlIiwidXNlcl90eXBlIjoiRU1QTE9ZRUUiLCJjbGllbnRfaWQiOiJkZGNhZjBiYS0xMTMxLTIyMzItMzMxMy1kNmYyNzUzZjI1ZGMiLCJzY29wZSI6WyJhcGkuciIsImFwaS53Il19.gteJiy1uao8HLeWRljpZxHWUgQfofwmnFP-zv3EPUyXjyCOy3xclnfeTnTE39j8PgBwdFASPcDLLk1YfZJbsU6pLlmYXLtdpHDBsVmIRuch6LFPCVQ3JdqSQVci59OhSK0bBThGWqCD3UzDI_OnX4IVCAahcT9Bu94m5u_H_JNmwDf1XaP3Lt4I34buYMuRD9stchsnZi-tuIRkL13FARm1XA9aPZUMUXFdedBWDXo1zMREQ_qCJXOpaZDJM9Im0rIkq9wTEVU00pbRp_Vcdya3dfkFteBMHiwFVt6VNQaco5BXURDAIzXidwQxNEbX1ek03wra8AIani65ZK7fy_w ``` Add "Authorization" header with value as above token and a dummy message will return from the generated stub. - diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/bodyParams.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/bodyParams.mustache index c7d1abfe527..cf3f9c3add9 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/bodyParams.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/bodyParams.mustache @@ -1 +1 @@ -{{#isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file +{{#isBodyParam}}{{{dataType}}} {{{paramName}}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/enumOuterClass.mustache index 5333fff8c06..f2805b0f72a 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/enumOuterClass.mustache @@ -3,8 +3,8 @@ {{/jackson}} /** -* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} -*/ + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + */ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/generatedAnnotation.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/generatedAnnotation.mustache index 875d7b97afe..10843695a9a 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/generatedAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/generatedAnnotation.mustache @@ -1 +1 @@ -@javax.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}}) \ No newline at end of file +@javax.annotation.Generated(value = "{{{generatorClass}}}"{{^hideGenerationTimestamp}}, date = "{{{generatedDate}}}"{{/hideGenerationTimestamp}}) \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/handler.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/handler.mustache index 4cb411f79d6..acf876b7975 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/handler.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/handler.mustache @@ -1,34 +1,161 @@ +{{>licenseInfo}} package org.openapitools.handler; -import com.networknt.config.Config; import com.networknt.server.HandlerProvider; import io.undertow.Handlers; import io.undertow.server.HttpHandler; import io.undertow.server.HttpServerExchange; +import io.undertow.server.RoutingHandler; +import io.undertow.server.handlers.PathHandler; import io.undertow.util.Methods; -public class PathHandlerProvider implements HandlerProvider { +/** + * The default implementation for {@link HandlerProvider} and {@link PathHandlerInterface}. + * + *

There are two flavors of {@link HttpHandler}s to choose from, depending on your needs:

+ * + *
    + *
  • + * Stateless: if a specific endpoint is called more than once from multiple sessions, + * its state is not retained – a different {@link HttpHandler} is instantiated for every new + * session. This is the default behavior. + *
  • + *
  • + * Stateful: if a specific endpoint is called more than once from multiple sessions, + * its state is retained properly. For example, if you want to keep a class property that counts + * the number of requests or the last time a request was received. + *
  • + *
+ *

Note: Stateful flavor is more performant than Stateless.

+ */ +@SuppressWarnings("TooManyFunctions") +abstract public class PathHandlerProvider implements HandlerProvider, PathHandlerInterface { + /** + * Returns the default base path to access this server. + */ + @javax.annotation.Nonnull + public String getBasePath() { + return "{{{basePathWithoutHost}}}"; + } + /** + * Returns a stateless {@link HttpHandler} that configures all endpoints in this server. + * + *

Endpoints bound in this method do NOT start with "{{{basePathWithoutHost}}}", and + * it's your responsibility to configure a {@link PathHandler} with a prefix path + * by calling {@link PathHandler#addPrefixPath} like so:

+ * + * pathHandler.addPrefixPath("{{{basePathWithoutHost}}}", handler) + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't + * retain any state between multiple sessions.

+ * + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @javax.annotation.Nonnull + @Override public HttpHandler getHandler() { - HttpHandler handler = Handlers.routing() + return getHandler(false); + } + /** + * Returns a stateless {@link HttpHandler} that configures all endpoints in this server. + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't + * retain any state between multiple sessions.

+ * + * @param withBasePath if true, all endpoints would start with "{{{basePathWithoutHost}}}" + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @javax.annotation.Nonnull + public HttpHandler getHandler(final boolean withBasePath) { + return getHandler(withBasePath ? getBasePath() : ""); + } + + /** + * Returns a stateless {@link HttpHandler} that configures all endpoints in this server. + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't + * retain any state between multiple sessions.

+ * + * @param basePath base path to set for all endpoints + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @SuppressWarnings("Convert2Lambda") + @javax.annotation.Nonnull + public HttpHandler getHandler(final String basePath) { + return Handlers.routing() {{#apiInfo}} -{{#apis}} -{{#operations}} -{{#operation}} - - .add(Methods.{{httpMethod}}, "{{{basePathWithoutHost}}}{{{path}}}", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("{{operationId}}"); - } - }) - -{{/operation}} -{{/operations}} -{{/apis}} + {{#apis}} + {{#operations}} + {{#operation}} + .add(Methods.{{{httpMethod}}}, basePath + "{{{path}}}", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + {{{operationId}}}().handleRequest(exchange); + } + }) + {{/operation}} + {{/operations}} + {{/apis}} + ; +{{/apiInfo}} + } + + /** + * Returns a stateful {@link HttpHandler} that configures all endpoints in this server. + * + *

Endpoints bound in this method do NOT start with "{{{basePathWithoutHost}}}", and + * it's your responsibility to configure a {@link PathHandler} with a prefix path + * by calling {@link PathHandler#addPrefixPath} like so:

+ * + * pathHandler.addPrefixPath("{{{basePathWithoutHost}}}", handler) + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will + * retain any state between multiple sessions.

+ * + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @javax.annotation.Nonnull + public HttpHandler getStatefulHandler() { + return getStatefulHandler(false); + } + + /** + * Returns a stateful {@link HttpHandler} that configures all endpoints in this server. + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will + * retain any state between multiple sessions.

+ * + * @param withBasePath if true, all endpoints would start with "{{{basePathWithoutHost}}}" + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @javax.annotation.Nonnull + public HttpHandler getStatefulHandler(final boolean withBasePath) { + return getStatefulHandler(withBasePath ? getBasePath() : ""); + } + + /** + * Returns a stateful {@link HttpHandler} that configures all endpoints in this server. + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will + * retain any state between multiple sessions.

+ * + * @param basePath base path to set for all endpoints + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @javax.annotation.Nonnull + public HttpHandler getStatefulHandler(final String basePath) { + return Handlers.routing() +{{#apiInfo}} + {{#apis}} + {{#operations}} + {{#operation}} + .add(Methods.{{{httpMethod}}}, basePath + "{{{path}}}", {{{operationId}}}()) + {{/operation}} + {{/operations}} + {{/apis}} + ; {{/apiInfo}} - ; - return handler; } } - diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/inflector.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/inflector.mustache index 87fc5581316..c4b62bbd8a9 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/inflector.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/inflector.mustache @@ -1,10 +1,10 @@ -controllerPackage: {{invokerPackage}} -modelPackage: {{modelPackage}} +controllerPackage: {{{invokerPackage}}} +modelPackage: {{{modelPackage}}} swaggerUrl: ./src/main/swagger/swagger.yaml modelMappings: # to enable explicit mappings, use this syntax: DefinitionFromSwaggerSpecification: fully.qualified.path.to.Model - {{#models}}{{#model}}{{classname}} : {{modelPackage}}.{{classname}}{{/model}} + {{#models}}{{#model}}{{{classname}}} : {{{modelPackage}}}.{{{classname}}}{{/model}} {{/models}} entityProcessors: diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/interface.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/interface.mustache new file mode 100644 index 00000000000..7dfd94228a8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/interface.mustache @@ -0,0 +1,76 @@ +{{>licenseInfo}} +package org.openapitools.handler; + +import io.undertow.server.*; +import io.undertow.util.*; + +import {{modelPackage}}.*; + +@SuppressWarnings("TooManyFunctions") +public interface PathHandlerInterface { +{{#apiInfo}} + {{#apis}} + {{#operations}} + {{#operation}} + + /** +{{#summary}} *

{{{summary}}}

+ * +{{/summary}} +{{#notes}} *

{{{notes}}}

+ * +{{/notes}} + *

Endpoint: {@link Methods#{{{httpMethod}}} {{{httpMethod}}}} "{{{basePathWithoutHost}}}{{{path}}}" (privileged: {{{hasAuthMethods}}})

+{{#hasParams}} + * + *

Request parameters:

+ *
    + {{#allParams}} + {{^isBodyParam}} + *
  • + *

    "{{{baseName}}}" +{{#description}} *

    {{{description}}}

    +{{/description}} + *

    + * - Parameter type: {{>isContainerDoc}}{{#isModel}}{@link {{{dataType}}}}{{/isModel}}{{^isModel}}{{#isFile}}{{#isBinary}}Binary{{/isBinary}}File{{/isFile}}{{^isFile}}{@link {{dataType}}}{{/isFile}}{{/isModel}}
    + * - Appears in: {{#isFormParam}}{@link io.undertow.server.handlers.form.FormDataParser Form}{{/isFormParam}}{{#isQueryParam}}{@link HttpServerExchange#getQueryParameters Query}{{/isQueryParam}}{{#isPathParam}}{@link HttpServerExchange#getPathParameters Path}{{/isPathParam}}{{#isHeaderParam}}{@link Headers Header}{{/isHeaderParam}}{{#isCookieParam}}{@link HttpServerExchange#getRequestCookie Cookie}{{/isCookieParam}}{{#isBodyParam}}{@link HttpServerExchange#getRequestChannel Body}{{/isBodyParam}}
    +{{#defaultValue}} * - Default value: {{{defaultValue}}}
    +{{/defaultValue}} + * - Required: {{{required}}} + *

    + *
  • + {{/isBodyParam}} + {{/allParams}} + *
+{{/hasParams}} +{{#hasResponseHeaders}} + *

Response headers: [{{#responseHeaders}}{{{.}}}{{^-last}}, {{/-last}}{{/responseHeaders}}]

+{{/hasResponseHeaders}} +{{#hasConsumes}} + * + *

Consumes: {{{consumes}}}

+{{#hasBodyParam}}{{#bodyParam}} *

Payload: {{>isContainerDoc}}{{#isModel}}{@link {{{dataType}}}}{{/isModel}}{{^isModel}}{{#isFile}}{{#isBinary}}Binary {{/isBinary}}File{{/isFile}}{{^isFile}}{@link {{baseType}}}{{/isFile}}{{/isModel}} (required: {{{required}}}{{/bodyParam}})

+{{/hasBodyParam}} +{{/hasConsumes}} + * +{{#hasProduces}} *

Produces: {{{produces}}}

+{{/hasProduces}} +{{#returnBaseType}} *

Returns: {{>isContainerDoc}}{@link {{{returnBaseType}}}}

+{{/returnBaseType}} + * + *

Responses:

+ *
    +{{#responses}} + *
  • {{#isDefault}}Default{{/isDefault}}{{^isDefault}}{{{code}}} ({{#is1xx}}informative{{/is1xx}}{{#is2xx}}success{{/is2xx}}{{#is3xx}}redirection{{/is3xx}}{{#is4xx}}client error{{/is4xx}}{{#is5xx}}server error{{/is5xx}}){{/isDefault}}{{#message}}: {{{message}}}{{/message}}
  • +{{/responses}} + *
+ */ + @javax.annotation.Nonnull +{{#isDeprecated}} @Deprecated +{{/isDeprecated}} + HttpHandler {{{operationId}}}(); + {{/operation}} + {{/operations}} + {{/apis}} +{{/apiInfo}} +} diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/isContainerDoc.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/isContainerDoc.mustache new file mode 100644 index 00000000000..d219fde2cc3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/isContainerDoc.mustache @@ -0,0 +1 @@ +{{#isArray}}{@link java.util.List List} of {{/isArray}}{{#isMap}}{@link java.util.Map Map} of {{/isMap}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/licenseInfo.mustache new file mode 100644 index 00000000000..09f65c73d83 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/licenseInfo.mustache @@ -0,0 +1,10 @@ +/* + * {{{appName}}} + * + * {{{appDescription}}} + * + * {{#version}}OpenAPI document version: {{{version}}}{{/version}} + * {{#infoEmail}}Maintained by: {{{infoEmail}}}{{/infoEmail}} + * + * AUTO-GENERATED FILE, DO NOT MODIFY! + */ \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/model.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/model.mustache index b9512d2b83c..addae4dd4d4 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/model.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/model.mustache @@ -1,15 +1,16 @@ +{{>licenseInfo}} package {{package}}; import java.util.Objects; -{{#imports}}import {{import}}; +{{#imports}}import {{{import}}}; {{/imports}} {{#serializableModel}}import java.io.Serializable;{{/serializableModel}} {{#models}} {{#model}}{{#description}} /** - * {{description}} - **/{{/description}} + * {{{description}}} + */{{/description}} {{#isEnum}}{{>enumOuterClass}}{{/isEnum}} {{^isEnum}}{{>pojo}}{{/isEnum}} {{/model}} diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/pathParams.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/pathParams.mustache index 6829cf8c7a6..e31bf798d10 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/pathParams.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/pathParams.mustache @@ -1 +1 @@ -{{#isPathParam}}{{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file +{{#isPathParam}}{{{dataType}}} {{{paramName}}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/pojo.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/pojo.mustache index 03c38d0ed77..f40d5b3de4a 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/pojo.mustache @@ -4,23 +4,23 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali {{#vars}}{{#isEnum}}{{^isContainer}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} - + {{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} - private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}} + private {{{datatypeWithEnum}}} {{{name}}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}} {{#vars}} /**{{#description}} * {{{description}}}{{/description}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} - **/ - public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { - this.{{name}} = {{name}}; + * minimum: {{{minimum}}}{{/minimum}}{{#maximum}} + * maximum: {{{maximum}}}{{/maximum}} + */ + public {{{classname}}} {{{name}}}({{{datatypeWithEnum}}} {{{name}}}) { + this.{{{name}}} = {{{name}}}; return this; } {{#vendorExtensions.x-extra-annotation}}{{{vendorExtensions.x-extra-annotation}}}{{/vendorExtensions.x-extra-annotation}} - @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") + @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{{required}}}, {{/required}}value = "{{{description}}}") @JsonProperty("{{baseName}}") public {{{datatypeWithEnum}}} {{getter}}() { return {{name}}; @@ -39,23 +39,23 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali if (o == null || getClass() != o.getClass()) { return false; } - {{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}} - return {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{^-last}} && + {{{classname}}} {{{classVarName}}} = ({{{classname}}}) o;{{#hasVars}} + return {{#vars}}Objects.equals({{{name}}}, {{{classVarName}}}.{{{name}}}){{^-last}} && {{/-last}}{{#-last}};{{/-last}}{{/vars}}{{/hasVars}}{{^hasVars}} return true;{{/hasVars}} } @Override public int hashCode() { - return Objects.hash({{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}); + return Objects.hash({{#vars}}{{{name}}}{{^-last}}, {{/-last}}{{/vars}}); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class {{classname}} {\n"); + sb.append("class {{{classname}}} {\n"); {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} - {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{#vars}}sb.append(" {{{name}}}: ").append(toIndentedString({{{name}}})).append("\n"); {{/vars}}sb.append("}"); return sb.toString(); } diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache index 3a63b72d59d..12ee539f8a3 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache @@ -6,11 +6,11 @@ 5 4.0.0 - {{groupId}} - {{artifactId}} + {{{groupId}}} + {{{artifactId}}} jar - {{artifactId}} - {{artifactVersion}} + {{{artifactId}}} + {{{artifactVersion}}} 1.8 diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/queryParams.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/queryParams.mustache index ff79730471d..711bb3cf918 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}{{{dataType}}} {{{paramName}}}{{/isQueryParam}} \ No newline at end of file diff --git a/samples/server/petstore/java-undertow/.openapi-generator/FILES b/samples/server/petstore/java-undertow/.openapi-generator/FILES index 8857fbfab67..780862a8b8f 100644 --- a/samples/server/petstore/java-undertow/.openapi-generator/FILES +++ b/samples/server/petstore/java-undertow/.openapi-generator/FILES @@ -1,5 +1,6 @@ README.md pom.xml +src/main/java/org/openapitools/handler/PathHandlerInterface.java src/main/java/org/openapitools/handler/PathHandlerProvider.java src/main/java/org/openapitools/model/Category.java src/main/java/org/openapitools/model/ModelApiResponse.java diff --git a/samples/server/petstore/java-undertow/.openapi-generator/VERSION b/samples/server/petstore/java-undertow/.openapi-generator/VERSION index d99e7162d01..3fa3b389a57 100644 --- a/samples/server/petstore/java-undertow/.openapi-generator/VERSION +++ b/samples/server/petstore/java-undertow/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-undertow/README.md b/samples/server/petstore/java-undertow/README.md index a983dba343c..f452d35095a 100644 --- a/samples/server/petstore/java-undertow/README.md +++ b/samples/server/petstore/java-undertow/README.md @@ -10,15 +10,13 @@ mvn package exec:exec ## Test -By default, all endpoints are protected by OAuth jwt token verifier. It can be turned off with config change through for development. - +By default, all endpoints are protected by the OAuth JWT token verifier. It can be turned off with a config change, when required. In order to access the server, there is a long lived token below issued by my -oauth2 server [undertow-server-oauth2](https://github.com/networknt/undertow-server-oauth2) +OAuth2 server [undertow-server-oauth2](https://github.com/networknt/undertow-server-oauth2). ``` Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJ1cm46Y29tOm5ldHdvcmtudDpvYXV0aDI6djEiLCJhdWQiOiJ1cm46Y29tLm5ldHdvcmtudCIsImV4cCI6MTc4ODEzMjczNSwianRpIjoiNWtyM2ZWOHJaelBZNEJrSnNYZzFpQSIsImlhdCI6MTQ3Mjc3MjczNSwibmJmIjoxNDcyNzcyNjE1LCJ2ZXJzaW9uIjoiMS4wIiwidXNlcl9pZCI6InN0ZXZlIiwidXNlcl90eXBlIjoiRU1QTE9ZRUUiLCJjbGllbnRfaWQiOiJkZGNhZjBiYS0xMTMxLTIyMzItMzMxMy1kNmYyNzUzZjI1ZGMiLCJzY29wZSI6WyJhcGkuciIsImFwaS53Il19.gteJiy1uao8HLeWRljpZxHWUgQfofwmnFP-zv3EPUyXjyCOy3xclnfeTnTE39j8PgBwdFASPcDLLk1YfZJbsU6pLlmYXLtdpHDBsVmIRuch6LFPCVQ3JdqSQVci59OhSK0bBThGWqCD3UzDI_OnX4IVCAahcT9Bu94m5u_H_JNmwDf1XaP3Lt4I34buYMuRD9stchsnZi-tuIRkL13FARm1XA9aPZUMUXFdedBWDXo1zMREQ_qCJXOpaZDJM9Im0rIkq9wTEVU00pbRp_Vcdya3dfkFteBMHiwFVt6VNQaco5BXURDAIzXidwQxNEbX1ek03wra8AIani65ZK7fy_w ``` Add "Authorization" header with value as above token and a dummy message will return from the generated stub. - diff --git a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java new file mode 100644 index 00000000000..5733e1ee0b0 --- /dev/null +++ b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java @@ -0,0 +1,604 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI document version: 1.0.0 + * + * + * AUTO-GENERATED FILE, DO NOT MODIFY! + */ +package org.openapitools.handler; + +import io.undertow.server.*; +import io.undertow.util.*; + +import org.openapitools.model.*; + +@SuppressWarnings("TooManyFunctions") +public interface PathHandlerInterface { + + /** + *

Add a new pet to the store

+ * + *

Endpoint: {@link Methods#POST POST} "/v2/pet" (privileged: true)

+ * + *

Request parameters:

+ *
    + *
+ * + *

Consumes: [{mediaType=application/json}, {mediaType=application/xml}]

+ *

Payload: {@link Pet} (required: true)

+ * + * + *

Responses:

+ *
    + *
  • 405 (client error): Invalid input
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler addPet(); + + /** + *

Deletes a pet

+ * + *

Endpoint: {@link Methods#DELETE DELETE} "/v2/pet/{petId}" (privileged: true)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "petId" + *

    Pet id to delete

    + *

    + * - Parameter type: {@link Long}
    + * - Appears in: {@link HttpServerExchange#getPathParameters Path}
    + * - Required: true + *

    + *
  • + *
  • + *

    "api_key" + *

    + * - Parameter type: {@link String}
    + * - Appears in: {@link Headers Header}
    + * - Required: false + *

    + *
  • + *
+ * + * + *

Responses:

+ *
    + *
  • 400 (client error): Invalid pet value
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler deletePet(); + + /** + *

Finds Pets by status

+ * + *

Multiple status values can be provided with comma separated strings

+ * + *

Endpoint: {@link Methods#GET GET} "/v2/pet/findByStatus" (privileged: true)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "status" + *

    Status values that need to be considered for filter

    + *

    + * - Parameter type: {@link java.util.List List} of {@link List<String>}
    + * - Appears in: {@link HttpServerExchange#getQueryParameters Query}
    + * - Default value: new ArrayList()
    + * - Required: true + *

    + *
  • + *
+ * + *

Produces: [{mediaType=application/xml}, {mediaType=application/json}]

+ *

Returns: {@link java.util.List List} of {@link Pet}

+ * + *

Responses:

+ *
    + *
  • 200 (success): successful operation
  • + *
  • 400 (client error): Invalid status value
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler findPetsByStatus(); + + /** + *

Finds Pets by tags

+ * + *

Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

+ * + *

Endpoint: {@link Methods#GET GET} "/v2/pet/findByTags" (privileged: true)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "tags" + *

    Tags to filter by

    + *

    + * - Parameter type: {@link java.util.List List} of {@link List<String>}
    + * - Appears in: {@link HttpServerExchange#getQueryParameters Query}
    + * - Default value: new ArrayList()
    + * - Required: true + *

    + *
  • + *
+ * + *

Produces: [{mediaType=application/xml}, {mediaType=application/json}]

+ *

Returns: {@link java.util.List List} of {@link Pet}

+ * + *

Responses:

+ *
    + *
  • 200 (success): successful operation
  • + *
  • 400 (client error): Invalid tag value
  • + *
+ */ + @javax.annotation.Nonnull + @Deprecated + HttpHandler findPetsByTags(); + + /** + *

Find pet by ID

+ * + *

Returns a single pet

+ * + *

Endpoint: {@link Methods#GET GET} "/v2/pet/{petId}" (privileged: true)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "petId" + *

    ID of pet to return

    + *

    + * - Parameter type: {@link Long}
    + * - Appears in: {@link HttpServerExchange#getPathParameters Path}
    + * - Required: true + *

    + *
  • + *
+ * + *

Produces: [{mediaType=application/xml}, {mediaType=application/json}]

+ *

Returns: {@link Pet}

+ * + *

Responses:

+ *
    + *
  • 200 (success): successful operation
  • + *
  • 400 (client error): Invalid ID supplied
  • + *
  • 404 (client error): Pet not found
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler getPetById(); + + /** + *

Update an existing pet

+ * + *

Endpoint: {@link Methods#PUT PUT} "/v2/pet" (privileged: true)

+ * + *

Request parameters:

+ *
    + *
+ * + *

Consumes: [{mediaType=application/json}, {mediaType=application/xml}]

+ *

Payload: {@link Pet} (required: true)

+ * + * + *

Responses:

+ *
    + *
  • 400 (client error): Invalid ID supplied
  • + *
  • 404 (client error): Pet not found
  • + *
  • 405 (client error): Validation exception
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler updatePet(); + + /** + *

Updates a pet in the store with form data

+ * + *

Endpoint: {@link Methods#POST POST} "/v2/pet/{petId}" (privileged: true)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "petId" + *

    ID of pet that needs to be updated

    + *

    + * - Parameter type: {@link Long}
    + * - Appears in: {@link HttpServerExchange#getPathParameters Path}
    + * - Required: true + *

    + *
  • + *
  • + *

    "name" + *

    Updated name of the pet

    + *

    + * - Parameter type: {@link String}
    + * - Appears in: {@link io.undertow.server.handlers.form.FormDataParser Form}
    + * - Required: false + *

    + *
  • + *
  • + *

    "status" + *

    Updated status of the pet

    + *

    + * - Parameter type: {@link String}
    + * - Appears in: {@link io.undertow.server.handlers.form.FormDataParser Form}
    + * - Required: false + *

    + *
  • + *
+ * + *

Consumes: [{mediaType=application/x-www-form-urlencoded}]

+ * + * + *

Responses:

+ *
    + *
  • 405 (client error): Invalid input
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler updatePetWithForm(); + + /** + *

uploads an image

+ * + *

Endpoint: {@link Methods#POST POST} "/v2/pet/{petId}/uploadImage" (privileged: true)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "petId" + *

    ID of pet to update

    + *

    + * - Parameter type: {@link Long}
    + * - Appears in: {@link HttpServerExchange#getPathParameters Path}
    + * - Required: true + *

    + *
  • + *
  • + *

    "additionalMetadata" + *

    Additional data to pass to server

    + *

    + * - Parameter type: {@link String}
    + * - Appears in: {@link io.undertow.server.handlers.form.FormDataParser Form}
    + * - Required: false + *

    + *
  • + *
  • + *

    "file" + *

    file to upload

    + *

    + * - Parameter type: BinaryFile
    + * - Appears in: {@link io.undertow.server.handlers.form.FormDataParser Form}
    + * - Required: false + *

    + *
  • + *
+ * + *

Consumes: [{mediaType=multipart/form-data}]

+ * + *

Produces: [{mediaType=application/json}]

+ *

Returns: {@link ModelApiResponse}

+ * + *

Responses:

+ *
    + *
  • 200 (success): successful operation
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler uploadFile(); + + /** + *

Delete purchase order by ID

+ * + *

For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

+ * + *

Endpoint: {@link Methods#DELETE DELETE} "/v2/store/order/{orderId}" (privileged: false)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "orderId" + *

    ID of the order that needs to be deleted

    + *

    + * - Parameter type: {@link String}
    + * - Appears in: {@link HttpServerExchange#getPathParameters Path}
    + * - Required: true + *

    + *
  • + *
+ * + * + *

Responses:

+ *
    + *
  • 400 (client error): Invalid ID supplied
  • + *
  • 404 (client error): Order not found
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler deleteOrder(); + + /** + *

Returns pet inventories by status

+ * + *

Returns a map of status codes to quantities

+ * + *

Endpoint: {@link Methods#GET GET} "/v2/store/inventory" (privileged: true)

+ * + *

Produces: [{mediaType=application/json}]

+ *

Returns: {@link java.util.Map Map} of {@link Integer}

+ * + *

Responses:

+ *
    + *
  • 200 (success): successful operation
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler getInventory(); + + /** + *

Find purchase order by ID

+ * + *

For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions

+ * + *

Endpoint: {@link Methods#GET GET} "/v2/store/order/{orderId}" (privileged: false)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "orderId" + *

    ID of pet that needs to be fetched

    + *

    + * - Parameter type: {@link Long}
    + * - Appears in: {@link HttpServerExchange#getPathParameters Path}
    + * - Required: true + *

    + *
  • + *
+ * + *

Produces: [{mediaType=application/xml}, {mediaType=application/json}]

+ *

Returns: {@link Order}

+ * + *

Responses:

+ *
    + *
  • 200 (success): successful operation
  • + *
  • 400 (client error): Invalid ID supplied
  • + *
  • 404 (client error): Order not found
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler getOrderById(); + + /** + *

Place an order for a pet

+ * + *

Endpoint: {@link Methods#POST POST} "/v2/store/order" (privileged: false)

+ * + *

Request parameters:

+ *
    + *
+ * + *

Produces: [{mediaType=application/xml}, {mediaType=application/json}]

+ *

Returns: {@link Order}

+ * + *

Responses:

+ *
    + *
  • 200 (success): successful operation
  • + *
  • 400 (client error): Invalid Order
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler placeOrder(); + + /** + *

Create user

+ * + *

This can only be done by the logged in user.

+ * + *

Endpoint: {@link Methods#POST POST} "/v2/user" (privileged: false)

+ * + *

Request parameters:

+ *
    + *
+ * + * + *

Responses:

+ *
    + *
  • Default: successful operation
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler createUser(); + + /** + *

Creates list of users with given input array

+ * + *

Endpoint: {@link Methods#POST POST} "/v2/user/createWithArray" (privileged: false)

+ * + *

Request parameters:

+ *
    + *
+ * + * + *

Responses:

+ *
    + *
  • Default: successful operation
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler createUsersWithArrayInput(); + + /** + *

Creates list of users with given input array

+ * + *

Endpoint: {@link Methods#POST POST} "/v2/user/createWithList" (privileged: false)

+ * + *

Request parameters:

+ *
    + *
+ * + * + *

Responses:

+ *
    + *
  • Default: successful operation
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler createUsersWithListInput(); + + /** + *

Delete user

+ * + *

This can only be done by the logged in user.

+ * + *

Endpoint: {@link Methods#DELETE DELETE} "/v2/user/{username}" (privileged: false)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "username" + *

    The name that needs to be deleted

    + *

    + * - Parameter type: {@link String}
    + * - Appears in: {@link HttpServerExchange#getPathParameters Path}
    + * - Required: true + *

    + *
  • + *
+ * + * + *

Responses:

+ *
    + *
  • 400 (client error): Invalid username supplied
  • + *
  • 404 (client error): User not found
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler deleteUser(); + + /** + *

Get user by user name

+ * + *

Endpoint: {@link Methods#GET GET} "/v2/user/{username}" (privileged: false)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "username" + *

    The name that needs to be fetched. Use user1 for testing.

    + *

    + * - Parameter type: {@link String}
    + * - Appears in: {@link HttpServerExchange#getPathParameters Path}
    + * - Required: true + *

    + *
  • + *
+ * + *

Produces: [{mediaType=application/xml}, {mediaType=application/json}]

+ *

Returns: {@link User}

+ * + *

Responses:

+ *
    + *
  • 200 (success): successful operation
  • + *
  • 400 (client error): Invalid username supplied
  • + *
  • 404 (client error): User not found
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler getUserByName(); + + /** + *

Logs user into the system

+ * + *

Endpoint: {@link Methods#GET GET} "/v2/user/login" (privileged: false)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "username" + *

    The user name for login

    + *

    + * - Parameter type: {@link String}
    + * - Appears in: {@link HttpServerExchange#getQueryParameters Query}
    + * - Required: true + *

    + *
  • + *
  • + *

    "password" + *

    The password for login in clear text

    + *

    + * - Parameter type: {@link String}
    + * - Appears in: {@link HttpServerExchange#getQueryParameters Query}
    + * - Required: true + *

    + *
  • + *
+ *

Response headers: [CodegenProperty{openApiType='integer', baseName='X-Rate-Limit', complexType='null', getter='getxRateLimit', setter='setxRateLimit', description='calls per hour allowed by the user', dataType='Integer', datatypeWithEnum='Integer', dataFormat='int32', name='xRateLimit', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Rate-Limit;', baseType='Integer', containerType='null', title='null', unescapedDescription='calls per hour allowed by the user', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{ + "type" : "integer", + "format" : "int32" +}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=true, isInteger=true, isLong=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XRateLimit', nameInSnakeCase='X_RATE_LIMIT', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false}, CodegenProperty{openApiType='string', baseName='X-Expires-After', complexType='Date', getter='getxExpiresAfter', setter='setxExpiresAfter', description='date in UTC when toekn expires', dataType='Date', datatypeWithEnum='Date', dataFormat='date-time', name='xExpiresAfter', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Expires-After;', baseType='Date', containerType='null', title='null', unescapedDescription='date in UTC when toekn expires', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{ + "type" : "string", + "format" : "date-time" +}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isLong=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=true, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false}]

+ * + *

Produces: [{mediaType=application/xml}, {mediaType=application/json}]

+ *

Returns: {@link String}

+ * + *

Responses:

+ *
    + *
  • 200 (success): successful operation
  • + *
  • 400 (client error): Invalid username/password supplied
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler loginUser(); + + /** + *

Logs out current logged in user session

+ * + *

Endpoint: {@link Methods#GET GET} "/v2/user/logout" (privileged: false)

+ * + * + *

Responses:

+ *
    + *
  • Default: successful operation
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler logoutUser(); + + /** + *

Updated user

+ * + *

This can only be done by the logged in user.

+ * + *

Endpoint: {@link Methods#PUT PUT} "/v2/user/{username}" (privileged: false)

+ * + *

Request parameters:

+ *
    + *
  • + *

    "username" + *

    name that need to be deleted

    + *

    + * - Parameter type: {@link String}
    + * - Appears in: {@link HttpServerExchange#getPathParameters Path}
    + * - Required: true + *

    + *
  • + *
+ * + * + *

Responses:

+ *
    + *
  • 400 (client error): Invalid user supplied
  • + *
  • 404 (client error): User not found
  • + *
+ */ + @javax.annotation.Nonnull + HttpHandler updateUser(); +} diff --git a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerProvider.java b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerProvider.java index 2fc96fbbba3..0636e605513 100644 --- a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerProvider.java +++ b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerProvider.java @@ -1,159 +1,287 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI document version: 1.0.0 + * + * + * AUTO-GENERATED FILE, DO NOT MODIFY! + */ package org.openapitools.handler; -import com.networknt.config.Config; import com.networknt.server.HandlerProvider; import io.undertow.Handlers; import io.undertow.server.HttpHandler; import io.undertow.server.HttpServerExchange; +import io.undertow.server.RoutingHandler; +import io.undertow.server.handlers.PathHandler; import io.undertow.util.Methods; -public class PathHandlerProvider implements HandlerProvider { +/** + * The default implementation for {@link HandlerProvider} and {@link PathHandlerInterface}. + * + *

There are two flavors of {@link HttpHandler}s to choose from, depending on your needs:

+ * + *
    + *
  • + * Stateless: if a specific endpoint is called more than once from multiple sessions, + * its state is not retained – a different {@link HttpHandler} is instantiated for every new + * session. This is the default behavior. + *
  • + *
  • + * Stateful: if a specific endpoint is called more than once from multiple sessions, + * its state is retained properly. For example, if you want to keep a class property that counts + * the number of requests or the last time a request was received. + *
  • + *
+ *

Note: Stateful flavor is more performant than Stateless.

+ */ +@SuppressWarnings("TooManyFunctions") +abstract public class PathHandlerProvider implements HandlerProvider, PathHandlerInterface { + /** + * Returns the default base path to access this server. + */ + @javax.annotation.Nonnull + public String getBasePath() { + return "/v2"; + } + /** + * Returns a stateless {@link HttpHandler} that configures all endpoints in this server. + * + *

Endpoints bound in this method do NOT start with "/v2", and + * it's your responsibility to configure a {@link PathHandler} with a prefix path + * by calling {@link PathHandler#addPrefixPath} like so:

+ * + * pathHandler.addPrefixPath("/v2", handler) + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't + * retain any state between multiple sessions.

+ * + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @javax.annotation.Nonnull + @Override public HttpHandler getHandler() { - HttpHandler handler = Handlers.routing() + return getHandler(false); + } + /** + * Returns a stateless {@link HttpHandler} that configures all endpoints in this server. + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't + * retain any state between multiple sessions.

+ * + * @param withBasePath if true, all endpoints would start with "/v2" + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @javax.annotation.Nonnull + public HttpHandler getHandler(final boolean withBasePath) { + return getHandler(withBasePath ? getBasePath() : ""); + } - .add(Methods.POST, "/v2/pet", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("addPet"); - } - }) + /** + * Returns a stateless {@link HttpHandler} that configures all endpoints in this server. + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateless and won't + * retain any state between multiple sessions.

+ * + * @param basePath base path to set for all endpoints + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @SuppressWarnings("Convert2Lambda") + @javax.annotation.Nonnull + public HttpHandler getHandler(final String basePath) { + return Handlers.routing() + .add(Methods.POST, basePath + "/pet", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + addPet().handleRequest(exchange); + } + }) + .add(Methods.DELETE, basePath + "/pet/{petId}", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + deletePet().handleRequest(exchange); + } + }) + .add(Methods.GET, basePath + "/pet/findByStatus", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + findPetsByStatus().handleRequest(exchange); + } + }) + .add(Methods.GET, basePath + "/pet/findByTags", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + findPetsByTags().handleRequest(exchange); + } + }) + .add(Methods.GET, basePath + "/pet/{petId}", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + getPetById().handleRequest(exchange); + } + }) + .add(Methods.PUT, basePath + "/pet", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + updatePet().handleRequest(exchange); + } + }) + .add(Methods.POST, basePath + "/pet/{petId}", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + updatePetWithForm().handleRequest(exchange); + } + }) + .add(Methods.POST, basePath + "/pet/{petId}/uploadImage", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + uploadFile().handleRequest(exchange); + } + }) + .add(Methods.DELETE, basePath + "/store/order/{orderId}", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + deleteOrder().handleRequest(exchange); + } + }) + .add(Methods.GET, basePath + "/store/inventory", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + getInventory().handleRequest(exchange); + } + }) + .add(Methods.GET, basePath + "/store/order/{orderId}", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + getOrderById().handleRequest(exchange); + } + }) + .add(Methods.POST, basePath + "/store/order", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + placeOrder().handleRequest(exchange); + } + }) + .add(Methods.POST, basePath + "/user", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + createUser().handleRequest(exchange); + } + }) + .add(Methods.POST, basePath + "/user/createWithArray", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + createUsersWithArrayInput().handleRequest(exchange); + } + }) + .add(Methods.POST, basePath + "/user/createWithList", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + createUsersWithListInput().handleRequest(exchange); + } + }) + .add(Methods.DELETE, basePath + "/user/{username}", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + deleteUser().handleRequest(exchange); + } + }) + .add(Methods.GET, basePath + "/user/{username}", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + getUserByName().handleRequest(exchange); + } + }) + .add(Methods.GET, basePath + "/user/login", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + loginUser().handleRequest(exchange); + } + }) + .add(Methods.GET, basePath + "/user/logout", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + logoutUser().handleRequest(exchange); + } + }) + .add(Methods.PUT, basePath + "/user/{username}", new HttpHandler() { + @Override + public void handleRequest(HttpServerExchange exchange) throws Exception { + updateUser().handleRequest(exchange); + } + }) + ; + } + /** + * Returns a stateful {@link HttpHandler} that configures all endpoints in this server. + * + *

Endpoints bound in this method do NOT start with "/v2", and + * it's your responsibility to configure a {@link PathHandler} with a prefix path + * by calling {@link PathHandler#addPrefixPath} like so:

+ * + * pathHandler.addPrefixPath("/v2", handler) + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will + * retain any state between multiple sessions.

+ * + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @javax.annotation.Nonnull + public HttpHandler getStatefulHandler() { + return getStatefulHandler(false); + } - .add(Methods.DELETE, "/v2/pet/{petId}", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("deletePet"); - } - }) + /** + * Returns a stateful {@link HttpHandler} that configures all endpoints in this server. + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will + * retain any state between multiple sessions.

+ * + * @param withBasePath if true, all endpoints would start with "/v2" + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @javax.annotation.Nonnull + public HttpHandler getStatefulHandler(final boolean withBasePath) { + return getStatefulHandler(withBasePath ? getBasePath() : ""); + } - - .add(Methods.GET, "/v2/pet/findByStatus", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("findPetsByStatus"); - } - }) - - - .add(Methods.GET, "/v2/pet/findByTags", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("findPetsByTags"); - } - }) - - - .add(Methods.GET, "/v2/pet/{petId}", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("getPetById"); - } - }) - - - .add(Methods.PUT, "/v2/pet", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("updatePet"); - } - }) - - - .add(Methods.POST, "/v2/pet/{petId}", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("updatePetWithForm"); - } - }) - - - .add(Methods.POST, "/v2/pet/{petId}/uploadImage", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("uploadFile"); - } - }) - - - .add(Methods.DELETE, "/v2/store/order/{orderId}", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("deleteOrder"); - } - }) - - - .add(Methods.GET, "/v2/store/inventory", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("getInventory"); - } - }) - - - .add(Methods.GET, "/v2/store/order/{orderId}", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("getOrderById"); - } - }) - - - .add(Methods.POST, "/v2/store/order", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("placeOrder"); - } - }) - - - .add(Methods.POST, "/v2/user", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("createUser"); - } - }) - - - .add(Methods.POST, "/v2/user/createWithArray", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("createUsersWithArrayInput"); - } - }) - - - .add(Methods.POST, "/v2/user/createWithList", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("createUsersWithListInput"); - } - }) - - - .add(Methods.DELETE, "/v2/user/{username}", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("deleteUser"); - } - }) - - - .add(Methods.GET, "/v2/user/{username}", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("getUserByName"); - } - }) - - - .add(Methods.GET, "/v2/user/login", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("loginUser"); - } - }) - - - .add(Methods.GET, "/v2/user/logout", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("logoutUser"); - } - }) - - - .add(Methods.PUT, "/v2/user/{username}", new HttpHandler() { - public void handleRequest(HttpServerExchange exchange) throws Exception { - exchange.getResponseSender().send("updateUser"); - } - }) - - ; - return handler; + /** + * Returns a stateful {@link HttpHandler} that configures all endpoints in this server. + * + *

Note: the endpoints bound to the returned {@link HttpHandler} are stateful and will + * retain any state between multiple sessions.

+ * + * @param basePath base path to set for all endpoints + * @return an {@link HttpHandler} of type {@link RoutingHandler} + */ + @javax.annotation.Nonnull + public HttpHandler getStatefulHandler(final String basePath) { + return Handlers.routing() + .add(Methods.POST, basePath + "/pet", addPet()) + .add(Methods.DELETE, basePath + "/pet/{petId}", deletePet()) + .add(Methods.GET, basePath + "/pet/findByStatus", findPetsByStatus()) + .add(Methods.GET, basePath + "/pet/findByTags", findPetsByTags()) + .add(Methods.GET, basePath + "/pet/{petId}", getPetById()) + .add(Methods.PUT, basePath + "/pet", updatePet()) + .add(Methods.POST, basePath + "/pet/{petId}", updatePetWithForm()) + .add(Methods.POST, basePath + "/pet/{petId}/uploadImage", uploadFile()) + .add(Methods.DELETE, basePath + "/store/order/{orderId}", deleteOrder()) + .add(Methods.GET, basePath + "/store/inventory", getInventory()) + .add(Methods.GET, basePath + "/store/order/{orderId}", getOrderById()) + .add(Methods.POST, basePath + "/store/order", placeOrder()) + .add(Methods.POST, basePath + "/user", createUser()) + .add(Methods.POST, basePath + "/user/createWithArray", createUsersWithArrayInput()) + .add(Methods.POST, basePath + "/user/createWithList", createUsersWithListInput()) + .add(Methods.DELETE, basePath + "/user/{username}", deleteUser()) + .add(Methods.GET, basePath + "/user/{username}", getUserByName()) + .add(Methods.GET, basePath + "/user/login", loginUser()) + .add(Methods.GET, basePath + "/user/logout", logoutUser()) + .add(Methods.PUT, basePath + "/user/{username}", updateUser()) + ; } } - diff --git a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Category.java index bda35d2f045..4700938d352 100644 --- a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Category.java @@ -1,3 +1,13 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI document version: 1.0.0 + * + * + * AUTO-GENERATED FILE, DO NOT MODIFY! + */ package org.openapitools.model; import java.util.Objects; @@ -10,7 +20,7 @@ import io.swagger.annotations.ApiModelProperty; /** * A category for a pet - **/ + */ @ApiModel(description = "A category for a pet") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen") @@ -20,7 +30,7 @@ public class Category { private String name; /** - **/ + */ public Category id(Long id) { this.id = id; return this; @@ -37,7 +47,7 @@ public class Category { } /** - **/ + */ public Category name(String name) { this.name = name; return this; diff --git a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/ModelApiResponse.java index 0d4cb3865cb..04568d59bb5 100644 --- a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -1,3 +1,13 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI document version: 1.0.0 + * + * + * AUTO-GENERATED FILE, DO NOT MODIFY! + */ package org.openapitools.model; import java.util.Objects; @@ -10,7 +20,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Describes the result of uploading an image resource - **/ + */ @ApiModel(description = "Describes the result of uploading an image resource") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen") @@ -21,7 +31,7 @@ public class ModelApiResponse { private String message; /** - **/ + */ public ModelApiResponse code(Integer code) { this.code = code; return this; @@ -38,7 +48,7 @@ public class ModelApiResponse { } /** - **/ + */ public ModelApiResponse type(String type) { this.type = type; return this; @@ -55,7 +65,7 @@ public class ModelApiResponse { } /** - **/ + */ public ModelApiResponse message(String message) { this.message = message; return this; diff --git a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Order.java index f057848f0cf..2f7209f8ef7 100644 --- a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Order.java @@ -1,3 +1,13 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI document version: 1.0.0 + * + * + * AUTO-GENERATED FILE, DO NOT MODIFY! + */ package org.openapitools.model; import java.util.Objects; @@ -12,7 +22,7 @@ import java.util.Date; /** * An order for a pets from the pet store - **/ + */ @ApiModel(description = "An order for a pets from the pet store") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen") @@ -46,7 +56,7 @@ public class Order { private Boolean complete = false; /** - **/ + */ public Order id(Long id) { this.id = id; return this; @@ -63,7 +73,7 @@ public class Order { } /** - **/ + */ public Order petId(Long petId) { this.petId = petId; return this; @@ -80,7 +90,7 @@ public class Order { } /** - **/ + */ public Order quantity(Integer quantity) { this.quantity = quantity; return this; @@ -97,7 +107,7 @@ public class Order { } /** - **/ + */ public Order shipDate(Date shipDate) { this.shipDate = shipDate; return this; @@ -115,7 +125,7 @@ public class Order { /** * Order Status - **/ + */ public Order status(StatusEnum status) { this.status = status; return this; @@ -132,7 +142,7 @@ public class Order { } /** - **/ + */ public Order complete(Boolean complete) { this.complete = complete; return this; diff --git a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Pet.java index a80d291fc41..2837ebec20a 100644 --- a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Pet.java @@ -1,3 +1,13 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI document version: 1.0.0 + * + * + * AUTO-GENERATED FILE, DO NOT MODIFY! + */ package org.openapitools.model; import java.util.Objects; @@ -15,7 +25,7 @@ import org.openapitools.model.Tag; /** * A pet for sale in the pet store - **/ + */ @ApiModel(description = "A pet for sale in the pet store") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen") @@ -49,7 +59,7 @@ public class Pet { private StatusEnum status; /** - **/ + */ public Pet id(Long id) { this.id = id; return this; @@ -66,7 +76,7 @@ public class Pet { } /** - **/ + */ public Pet category(Category category) { this.category = category; return this; @@ -83,7 +93,7 @@ public class Pet { } /** - **/ + */ public Pet name(String name) { this.name = name; return this; @@ -100,7 +110,7 @@ public class Pet { } /** - **/ + */ public Pet photoUrls(List photoUrls) { this.photoUrls = photoUrls; return this; @@ -117,7 +127,7 @@ public class Pet { } /** - **/ + */ public Pet tags(List tags) { this.tags = tags; return this; @@ -135,7 +145,7 @@ public class Pet { /** * pet status in the store - **/ + */ public Pet status(StatusEnum status) { this.status = status; return this; diff --git a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Tag.java index a68f772854e..bab2a254cf2 100644 --- a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/Tag.java @@ -1,3 +1,13 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI document version: 1.0.0 + * + * + * AUTO-GENERATED FILE, DO NOT MODIFY! + */ package org.openapitools.model; import java.util.Objects; @@ -10,7 +20,7 @@ import io.swagger.annotations.ApiModelProperty; /** * A tag for a pet - **/ + */ @ApiModel(description = "A tag for a pet") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen") @@ -20,7 +30,7 @@ public class Tag { private String name; /** - **/ + */ public Tag id(Long id) { this.id = id; return this; @@ -37,7 +47,7 @@ public class Tag { } /** - **/ + */ public Tag name(String name) { this.name = name; return this; diff --git a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/User.java index 7ef8b096a8f..2e66108f65d 100644 --- a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/model/User.java @@ -1,3 +1,13 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI document version: 1.0.0 + * + * + * AUTO-GENERATED FILE, DO NOT MODIFY! + */ package org.openapitools.model; import java.util.Objects; @@ -10,7 +20,7 @@ import io.swagger.annotations.ApiModelProperty; /** * A User who is purchasing from the pet store - **/ + */ @ApiModel(description = "A User who is purchasing from the pet store") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen") @@ -26,7 +36,7 @@ public class User { private Integer userStatus; /** - **/ + */ public User id(Long id) { this.id = id; return this; @@ -43,7 +53,7 @@ public class User { } /** - **/ + */ public User username(String username) { this.username = username; return this; @@ -60,7 +70,7 @@ public class User { } /** - **/ + */ public User firstName(String firstName) { this.firstName = firstName; return this; @@ -77,7 +87,7 @@ public class User { } /** - **/ + */ public User lastName(String lastName) { this.lastName = lastName; return this; @@ -94,7 +104,7 @@ public class User { } /** - **/ + */ public User email(String email) { this.email = email; return this; @@ -111,7 +121,7 @@ public class User { } /** - **/ + */ public User password(String password) { this.password = password; return this; @@ -128,7 +138,7 @@ public class User { } /** - **/ + */ public User phone(String phone) { this.phone = phone; return this; @@ -146,7 +156,7 @@ public class User { /** * User Status - **/ + */ public User userStatus(Integer userStatus) { this.userStatus = userStatus; return this; diff --git a/samples/server/petstore/java-undertow/src/main/resources/config/openapi.json b/samples/server/petstore/java-undertow/src/main/resources/config/openapi.json index 1a863721712..e1554af7b8f 100644 --- a/samples/server/petstore/java-undertow/src/main/resources/config/openapi.json +++ b/samples/server/petstore/java-undertow/src/main/resources/config/openapi.json @@ -1037,5 +1037,6 @@ "type" : "apiKey" } } - } + }, + "x-original-swagger-version" : "2.0" } \ No newline at end of file From 8b2ac7b0ac0b863eaa0f7ce69e1bc8e591be4a3e Mon Sep 17 00:00:00 2001 From: "Anh (Duke) Nguyen" <58082199+dukeraphaelng@users.noreply.github.com> Date: Tue, 19 Jan 2021 19:38:53 +1100 Subject: [PATCH 06/54] Fix README typo for Crystal (#8470) * Fix README typo for Crystal * Fix README typo for Crystal in Mustache template --- .../src/main/resources/crystal/README.mustache | 2 +- samples/client/petstore/crystal/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/crystal/README.mustache b/modules/openapi-generator/src/main/resources/crystal/README.mustache index 20705236b9c..56a8bbf09d8 100644 --- a/modules/openapi-generator/src/main/resources/crystal/README.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/README.mustache @@ -1,6 +1,6 @@ # {{shardName}} -The Crystsal module for the {{appName}} +The Crystal module for the {{appName}} {{#appDescriptionWithNewLines}} {{{appDescriptionWithNewLines}}} diff --git a/samples/client/petstore/crystal/README.md b/samples/client/petstore/crystal/README.md index fc7fa03548c..35642629a13 100644 --- a/samples/client/petstore/crystal/README.md +++ b/samples/client/petstore/crystal/README.md @@ -1,6 +1,6 @@ # petstore -The Crystsal module for the OpenAPI Petstore +The Crystal module for the OpenAPI Petstore This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. From 62eecabfa568d2500def67c0b20f768f1147ac70 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 19 Jan 2021 22:38:34 +0800 Subject: [PATCH 07/54] [csharp-netcore] add .Net 5.0 support (#8467) * add net5.0 support to csharp-netcore client gen * update doc * update samples --- appveyor.yml | 4 + .../csharp-netcore-OpenAPIClient-net50.yaml | 13 + docs/generators/csharp-netcore.md | 2 +- .../languages/CSharpNetCoreClientCodegen.java | 5 +- .../OpenAPIClient-net5.0/.gitignore | 362 ++++ .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 42 + .../.openapi-generator/VERSION | 1 + .../OpenAPIClient-net5.0/Org.OpenAPITools.sln | 27 + .../OpenAPIClient-net5.0/README.md | 172 ++ .../OpenAPIClient-net5.0/appveyor.yml | 9 + .../OpenAPIClient-net5.0/docs/ApiResponse.md | 12 + .../OpenAPIClient-net5.0/docs/Category.md | 11 + .../OpenAPIClient-net5.0/docs/Order.md | 15 + .../OpenAPIClient-net5.0/docs/Pet.md | 15 + .../OpenAPIClient-net5.0/docs/PetApi.md | 608 +++++++ .../OpenAPIClient-net5.0/docs/StoreApi.md | 294 +++ .../OpenAPIClient-net5.0/docs/Tag.md | 11 + .../OpenAPIClient-net5.0/docs/User.md | 17 + .../OpenAPIClient-net5.0/docs/UserApi.md | 595 +++++++ .../OpenAPIClient-net5.0/git_push.sh | 58 + .../Org.OpenAPITools.Test/Api/PetApiTests.cs | 156 ++ .../Api/StoreApiTests.cs | 103 ++ .../Org.OpenAPITools.Test/Api/UserApiTests.cs | 148 ++ .../Model/ApiResponseTests.cs | 86 + .../Model/CategoryTests.cs | 78 + .../Org.OpenAPITools.Test/Model/OrderTests.cs | 110 ++ .../Org.OpenAPITools.Test/Model/PetTests.cs | 110 ++ .../Org.OpenAPITools.Test/Model/TagTests.cs | 78 + .../Org.OpenAPITools.Test/Model/UserTests.cs | 126 ++ .../Org.OpenAPITools.Test.csproj | 20 + .../src/Org.OpenAPITools/Api/PetApi.cs | 1572 +++++++++++++++++ .../src/Org.OpenAPITools/Api/StoreApi.cs | 778 ++++++++ .../src/Org.OpenAPITools/Api/UserApi.cs | 1482 ++++++++++++++++ .../src/Org.OpenAPITools/Client/ApiClient.cs | 835 +++++++++ .../Org.OpenAPITools/Client/ApiException.cs | 68 + .../Org.OpenAPITools/Client/ApiResponse.cs | 166 ++ .../Org.OpenAPITools/Client/ClientUtils.cs | 228 +++ .../Org.OpenAPITools/Client/Configuration.cs | 520 ++++++ .../Client/ExceptionFactory.cs | 22 + .../Client/GlobalConfiguration.cs | 67 + .../src/Org.OpenAPITools/Client/HttpMethod.cs | 33 + .../Org.OpenAPITools/Client/IApiAccessor.cs | 37 + .../Client/IAsynchronousClient.cs | 100 ++ .../Client/IReadableConfiguration.cs | 115 ++ .../Client/ISynchronousClient.cs | 93 + .../src/Org.OpenAPITools/Client/Multimap.cs | 295 ++++ .../Client/OpenAPIDateConverter.cs | 29 + .../Org.OpenAPITools/Client/RequestOptions.cs | 74 + .../Client/RetryConfiguration.cs | 21 + .../Model/AbstractOpenAPISchema.cs | 76 + .../src/Org.OpenAPITools/Model/ApiResponse.cs | 149 ++ .../src/Org.OpenAPITools/Model/Category.cs | 145 ++ .../src/Org.OpenAPITools/Model/Order.cs | 205 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 218 +++ .../src/Org.OpenAPITools/Model/Tag.cs | 138 ++ .../src/Org.OpenAPITools/Model/User.cs | 204 +++ .../Org.OpenAPITools/Org.OpenAPITools.csproj | 31 + 58 files changed, 11010 insertions(+), 2 deletions(-) create mode 100644 bin/configs/csharp-netcore-OpenAPIClient-net50.yaml create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.gitignore create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator-ignore create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/VERSION create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/Org.OpenAPITools.sln create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/appveyor.yml create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ApiResponse.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Category.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Order.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Pet.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/PetApi.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/StoreApi.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Tag.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/User.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/UserApi.md create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/git_push.sh create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/UserApiTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/PetTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/TagTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/UserTests.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/PetApi.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/StoreApi.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/UserApi.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiException.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiResponse.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ClientUtils.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Configuration.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ExceptionFactory.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/GlobalConfiguration.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/HttpMethod.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IApiAccessor.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IAsynchronousClient.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IReadableConfiguration.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ISynchronousClient.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Multimap.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/RequestOptions.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/RetryConfiguration.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ApiResponse.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Category.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Order.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Pet.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Tag.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/User.cs create mode 100644 samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj diff --git a/appveyor.yml b/appveyor.yml index 24610d9100e..b12d075eb40 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,6 +46,8 @@ build_script: - dotnet build samples\client\petstore\csharp-netcore\OpenAPIClientCore\Org.OpenAPITools.sln # build C# API client (.net framework 4.7) - dotnet build samples\client\petstore\csharp-netcore\OpenAPIClient-net47\Org.OpenAPITools.sln + # build C# API client (.net 5.0) + - dotnet build samples\client\petstore\csharp-netcore\OpenAPIClient-net5.0\Org.OpenAPITools.sln # build C# API client - nuget restore samples\client\petstore\csharp\OpenAPIClient\Org.OpenAPITools.sln - msbuild samples\client\petstore\csharp\OpenAPIClient\Org.OpenAPITools.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" @@ -65,6 +67,8 @@ test_script: - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj # test C# API client (.net framework 4.7) - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient-net47\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + # test C# API client (.net 5.0) + - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient-net5.0\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj # test c# API client - nunit3-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor # test c# API client (with PropertyChanged) diff --git a/bin/configs/csharp-netcore-OpenAPIClient-net50.yaml b/bin/configs/csharp-netcore-OpenAPIClient-net50.yaml new file mode 100644 index 00000000000..88194beae34 --- /dev/null +++ b/bin/configs/csharp-netcore-OpenAPIClient-net50.yaml @@ -0,0 +1,13 @@ +# for .net standard +generatorName: csharp-netcore +outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0 +# TODO switch to http signature spec after fixing compilation issues +#inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/csharp-netcore +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + useCompareNetObjects: true + disallowAdditionalPropertiesIfNotPresent: false + useOneOfDiscriminatorLookup: true + targetFramework: net5.0 diff --git a/docs/generators/csharp-netcore.md b/docs/generators/csharp-netcore.md index cf7870c5824..d2d2240d94c 100644 --- a/docs/generators/csharp-netcore.md +++ b/docs/generators/csharp-netcore.md @@ -28,7 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |returnICollection|Return ICollection<T> instead of the concrete type.| |false| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sourceFolder|source folder for generated code| |src| -|targetFramework|The target .NET framework version.|
**netstandard1.3**
.NET Standard 1.3 compatible
**netstandard1.4**
.NET Standard 1.4 compatible
**netstandard1.5**
.NET Standard 1.5 compatible
**netstandard1.6**
.NET Standard 1.6 compatible
**netstandard2.0**
.NET Standard 2.0 compatible
**netstandard2.1**
.NET Standard 2.1 compatible
**netcoreapp2.0**
.NET Core 2.0 compatible
**netcoreapp2.1**
.NET Core 2.1 compatible
**netcoreapp3.0**
.NET Core 3.0 compatible
**netcoreapp3.1**
.NET Core 3.1 compatible
**net47**
.NET Framework 4.7 compatible
|netstandard2.0| +|targetFramework|The target .NET framework version.|
**netstandard1.3**
.NET Standard 1.3 compatible
**netstandard1.4**
.NET Standard 1.4 compatible
**netstandard1.5**
.NET Standard 1.5 compatible
**netstandard1.6**
.NET Standard 1.6 compatible
**netstandard2.0**
.NET Standard 2.0 compatible
**netstandard2.1**
.NET Standard 2.1 compatible
**netcoreapp2.0**
.NET Core 2.0 compatible
**netcoreapp2.1**
.NET Core 2.1 compatible
**netcoreapp3.0**
.NET Core 3.0 compatible
**netcoreapp3.1**
.NET Core 3.1 compatible
**net47**
.NET Framework 4.7 compatible
**net5.0**
.NET 5.0 compatible
|netstandard2.0| |useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false| |useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false| |useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and onlye one match in oneOf's schemas) will be skipped.| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java index 12e3e15bb85..91763105be6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java @@ -63,7 +63,8 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen { FrameworkStrategy.NETCOREAPP_2_1, FrameworkStrategy.NETCOREAPP_3_0, FrameworkStrategy.NETCOREAPP_3_1, - FrameworkStrategy.NETFRAMEWORK_4_7 + FrameworkStrategy.NETFRAMEWORK_4_7, + FrameworkStrategy.NET_5_0 ); private static FrameworkStrategy defaultFramework = FrameworkStrategy.NETSTANDARD_2_0; protected final Map frameworks; @@ -908,6 +909,8 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen { }; static FrameworkStrategy NETFRAMEWORK_4_7 = new FrameworkStrategy("net47", ".NET Framework 4.7 compatible", "net47", Boolean.FALSE) { }; + static FrameworkStrategy NET_5_0 = new FrameworkStrategy("net5.0", ".NET 5.0 compatible", "net5.0", Boolean.FALSE) { + }; protected String name; protected String description; protected String testTargetFramework; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.gitignore b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.gitignore new file mode 100644 index 00000000000..1ee53850b84 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator-ignore b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES new file mode 100644 index 00000000000..60d0f82fefd --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES @@ -0,0 +1,42 @@ +.gitignore +Org.OpenAPITools.sln +README.md +appveyor.yml +docs/ApiResponse.md +docs/Category.md +docs/Order.md +docs/Pet.md +docs/PetApi.md +docs/StoreApi.md +docs/Tag.md +docs/User.md +docs/UserApi.md +git_push.sh +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools/Api/PetApi.cs +src/Org.OpenAPITools/Api/StoreApi.cs +src/Org.OpenAPITools/Api/UserApi.cs +src/Org.OpenAPITools/Client/ApiClient.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiResponse.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/Configuration.cs +src/Org.OpenAPITools/Client/ExceptionFactory.cs +src/Org.OpenAPITools/Client/GlobalConfiguration.cs +src/Org.OpenAPITools/Client/HttpMethod.cs +src/Org.OpenAPITools/Client/IApiAccessor.cs +src/Org.OpenAPITools/Client/IAsynchronousClient.cs +src/Org.OpenAPITools/Client/IReadableConfiguration.cs +src/Org.OpenAPITools/Client/ISynchronousClient.cs +src/Org.OpenAPITools/Client/Multimap.cs +src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs +src/Org.OpenAPITools/Client/RequestOptions.cs +src/Org.OpenAPITools/Client/RetryConfiguration.cs +src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs +src/Org.OpenAPITools/Model/ApiResponse.cs +src/Org.OpenAPITools/Model/Category.cs +src/Org.OpenAPITools/Model/Order.cs +src/Org.OpenAPITools/Model/Pet.cs +src/Org.OpenAPITools/Model/Tag.cs +src/Org.OpenAPITools/Model/User.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/VERSION b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/VERSION new file mode 100644 index 00000000000..3fa3b389a57 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/Org.OpenAPITools.sln b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/Org.OpenAPITools.sln new file mode 100644 index 00000000000..5b15451c9dc --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md new file mode 100644 index 00000000000..fe99cf17868 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md @@ -0,0 +1,172 @@ +# Org.OpenAPITools - the C# library for the OpenAPI Petstore + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- SDK version: 1.0.0 +- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen + + +## Frameworks supported + + +## Dependencies + +- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.11.4 or later +- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.3 or later +- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.7.0 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + +The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: +``` +Install-Package RestSharp +Install-Package Newtonsoft.Json +Install-Package JsonSubTypes +Install-Package System.ComponentModel.Annotations +Install-Package CompareNETObjects +``` + +NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) + + +## Installation +Run the following command to generate the DLL +- [Mac/Linux] `/bin/sh build.sh` +- [Windows] `build.bat` + +Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: +```csharp +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +``` + +## Packaging + +A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages. + +This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly: + +``` +nuget pack -Build -OutputDirectory out Org.OpenAPITools.csproj +``` + +Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual. + + +## Usage + +To use the API client with a HTTP proxy, setup a `System.Net.WebProxy` +```csharp +Configuration c = new Configuration(); +System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/"); +webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; +c.Proxy = webProxy; +``` + + +## Getting Started + +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class Example + { + public static void Main() + { + + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + Pet result = apiInstance.AddPet(pet); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + + } + } +} +``` + + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user +*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + + +## Documentation for Models + + - [Model.ApiResponse](docs/ApiResponse.md) + - [Model.Category](docs/Category.md) + - [Model.Order](docs/Order.md) + - [Model.Pet](docs/Pet.md) + - [Model.Tag](docs/Tag.md) + - [Model.User](docs/User.md) + + + +## Documentation for Authorization + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/appveyor.yml b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/appveyor.yml new file mode 100644 index 00000000000..f76f63cee50 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ApiResponse.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ApiResponse.md new file mode 100644 index 00000000000..f00988a69e4 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ApiResponse.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.ApiResponse +Describes the result of uploading an image resource +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | **int** | | [optional] +**Type** | **string** | | [optional] +**Message** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Category.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Category.md new file mode 100644 index 00000000000..1cf7b04e32a --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Category.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Category +A category for a pet +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Order.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Order.md new file mode 100644 index 00000000000..65388ca7b69 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Order.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Order +An order for a pets from the pet store +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**PetId** | **long** | | [optional] +**Quantity** | **int** | | [optional] +**ShipDate** | **DateTime** | | [optional] +**Status** | **string** | Order Status | [optional] +**Complete** | **bool** | | [optional] [default to false] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Pet.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Pet.md new file mode 100644 index 00000000000..86733711fc3 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Pet.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Pet +A pet for sale in the pet store +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Category** | [**Category**](Category.md) | | [optional] +**Name** | **string** | | +**PhotoUrls** | **List<string>** | | +**Tags** | [**List<Tag>**](Tag.md) | | [optional] +**Status** | **string** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/PetApi.md new file mode 100644 index 00000000000..b84b0be8b01 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/PetApi.md @@ -0,0 +1,608 @@ +# Org.OpenAPITools.Api.PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[**DeletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**FindPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[**FindPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[**GetPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image + + + +# **AddPet** +> Pet AddPet (Pet pet) + +Add a new pet to the store + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class AddPetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + Pet result = apiInstance.AddPet(pet); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **DeletePet** +> void DeletePet (long petId, string apiKey = null) + +Deletes a pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeletePetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789; // long | Pet id to delete + var apiKey = apiKey_example; // string | (optional) + + try + { + // Deletes a pet + apiInstance.DeletePet(petId, apiKey); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long**| Pet id to delete | + **apiKey** | **string**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FindPetsByStatus** +> List<Pet> FindPetsByStatus (List status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByStatusExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var status = status_example; // List | Status values that need to be considered for filter + + try + { + // Finds Pets by status + List result = apiInstance.FindPetsByStatus(status); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **List<string>**| Status values that need to be considered for filter | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FindPetsByTags** +> List<Pet> FindPetsByTags (List tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByTagsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var tags = new List(); // List | Tags to filter by + + try + { + // Finds Pets by tags + List result = apiInstance.FindPetsByTags(tags); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<string>**](string.md)| Tags to filter by | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetPetById** +> Pet GetPetById (long petId) + +Find pet by ID + +Returns a single pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetPetByIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key", "Bearer"); + + var apiInstance = new PetApi(config); + var petId = 789; // long | ID of pet to return + + try + { + // Find pet by ID + Pet result = apiInstance.GetPetById(petId); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UpdatePet** +> Pet UpdatePet (Pet pet) + +Update an existing pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Update an existing pet + Pet result = apiInstance.UpdatePet(pet); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UpdatePetWithForm** +> void UpdatePetWithForm (long petId, string name = null, string status = null) + +Updates a pet in the store with form data + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetWithFormExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789; // long | ID of pet that needs to be updated + var name = name_example; // string | Updated name of the pet (optional) + var status = status_example; // string | Updated status of the pet (optional) + + try + { + // Updates a pet in the store with form data + apiInstance.UpdatePetWithForm(petId, name, status); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long**| ID of pet that needs to be updated | + **name** | **string**| Updated name of the pet | [optional] + **status** | **string**| Updated status of the pet | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UploadFile** +> ApiResponse UploadFile (long petId, string additionalMetadata = null, System.IO.Stream file = null) + +uploads an image + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789; // long | ID of pet to update + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + var file = BINARY_DATA_HERE; // System.IO.Stream | file to upload (optional) + + try + { + // uploads an image + ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long**| ID of pet to update | + **additionalMetadata** | **string**| Additional data to pass to server | [optional] + **file** | **System.IO.Stream****System.IO.Stream**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/StoreApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/StoreApi.md new file mode 100644 index 00000000000..2ce2b83d430 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/StoreApi.md @@ -0,0 +1,294 @@ +# Org.OpenAPITools.Api.StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet + + + +# **DeleteOrder** +> void DeleteOrder (string orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteOrderExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + var apiInstance = new StoreApi(config); + var orderId = orderId_example; // string | ID of the order that needs to be deleted + + try + { + // Delete purchase order by ID + apiInstance.DeleteOrder(orderId); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **string**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetInventory** +> Dictionary<string, int> GetInventory () + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetInventoryExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key", "Bearer"); + + var apiInstance = new StoreApi(config); + + try + { + // Returns pet inventories by status + Dictionary result = apiInstance.GetInventory(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Dictionary** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetOrderById** +> Order GetOrderById (long orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetOrderByIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + var apiInstance = new StoreApi(config); + var orderId = 789; // long | ID of pet that needs to be fetched + + try + { + // Find purchase order by ID + Order result = apiInstance.GetOrderById(orderId); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **long**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **PlaceOrder** +> Order PlaceOrder (Order order) + +Place an order for a pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class PlaceOrderExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + var apiInstance = new StoreApi(config); + var order = new Order(); // Order | order placed for purchasing the pet + + try + { + // Place an order for a pet + Order result = apiInstance.PlaceOrder(order); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Tag.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Tag.md new file mode 100644 index 00000000000..319a2b6c745 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Tag.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Tag +A tag for a pet +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/User.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/User.md new file mode 100644 index 00000000000..d2cc8c29e42 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/User.md @@ -0,0 +1,17 @@ +# Org.OpenAPITools.Model.User +A User who is purchasing from the pet store +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Username** | **string** | | [optional] +**FirstName** | **string** | | [optional] +**LastName** | **string** | | [optional] +**Email** | **string** | | [optional] +**Password** | **string** | | [optional] +**Phone** | **string** | | [optional] +**UserStatus** | **int** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/UserApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/UserApi.md new file mode 100644 index 00000000000..b87e345d6bd --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/UserApi.md @@ -0,0 +1,595 @@ +# Org.OpenAPITools.Api.UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateUser**](UserApi.md#createuser) | **POST** /user | Create user +[**CreateUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**CreateUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**DeleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**GetUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**LoginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[**LogoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**UpdateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + + +# **CreateUser** +> void CreateUser (User user) + +Create user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key", "Bearer"); + + var apiInstance = new UserApi(config); + var user = new User(); // User | Created user object + + try + { + // Create user + apiInstance.CreateUser(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **CreateUsersWithArrayInput** +> void CreateUsersWithArrayInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithArrayInputExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key", "Bearer"); + + var apiInstance = new UserApi(config); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInput(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **CreateUsersWithListInput** +> void CreateUsersWithListInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithListInputExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key", "Bearer"); + + var apiInstance = new UserApi(config); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithListInput(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **DeleteUser** +> void DeleteUser (string username) + +Delete user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key", "Bearer"); + + var apiInstance = new UserApi(config); + var username = username_example; // string | The name that needs to be deleted + + try + { + // Delete user + apiInstance.DeleteUser(username); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetUserByName** +> User GetUserByName (string username) + +Get user by user name + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetUserByNameExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + var apiInstance = new UserApi(config); + var username = username_example; // string | The name that needs to be fetched. Use user1 for testing. + + try + { + // Get user by user name + User result = apiInstance.GetUserByName(username); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **LoginUser** +> string LoginUser (string username, string password) + +Logs user into the system + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LoginUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + var apiInstance = new UserApi(config); + var username = username_example; // string | The user name for login + var password = password_example; // string | The password for login in clear text + + try + { + // Logs user into the system + string result = apiInstance.LoginUser(username, password); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The user name for login | + **password** | **string**| The password for login in clear text | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when toekn expires
| +| **400** | Invalid username/password supplied | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **LogoutUser** +> void LogoutUser () + +Logs out current logged in user session + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LogoutUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key", "Bearer"); + + var apiInstance = new UserApi(config); + + try + { + // Logs out current logged in user session + apiInstance.LogoutUser(); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UpdateUser** +> void UpdateUser (string username, User user) + +Updated user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdateUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key", "Bearer"); + + var apiInstance = new UserApi(config); + var username = username_example; // string | name that need to be deleted + var user = new User(); // User | Updated user object + + try + { + // Updated user + apiInstance.UpdateUser(username, user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/git_push.sh b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/git_push.sh new file mode 100644 index 00000000000..ced3be2b0c7 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs new file mode 100644 index 00000000000..c1ed54241c6 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -0,0 +1,156 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using Xunit; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +// uncomment below to import models +//using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing PetApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + public class PetApiTests : IDisposable + { + private PetApi instance; + + public PetApiTests() + { + instance = new PetApi(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of PetApi + /// + [Fact] + public void InstanceTest() + { + // TODO uncomment below to test 'IsType' PetApi + //Assert.IsType(instance); + } + + /// + /// Test AddPet + /// + [Fact] + public void AddPetTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Pet pet = null; + //var response = instance.AddPet(pet); + //Assert.IsType(response); + } + + /// + /// Test DeletePet + /// + [Fact] + public void DeletePetTest() + { + // TODO uncomment below to test the method and replace null with proper value + //long petId = null; + //string apiKey = null; + //instance.DeletePet(petId, apiKey); + } + + /// + /// Test FindPetsByStatus + /// + [Fact] + public void FindPetsByStatusTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List status = null; + //var response = instance.FindPetsByStatus(status); + //Assert.IsType>(response); + } + + /// + /// Test FindPetsByTags + /// + [Fact] + public void FindPetsByTagsTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List tags = null; + //var response = instance.FindPetsByTags(tags); + //Assert.IsType>(response); + } + + /// + /// Test GetPetById + /// + [Fact] + public void GetPetByIdTest() + { + // TODO uncomment below to test the method and replace null with proper value + //long petId = null; + //var response = instance.GetPetById(petId); + //Assert.IsType(response); + } + + /// + /// Test UpdatePet + /// + [Fact] + public void UpdatePetTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Pet pet = null; + //var response = instance.UpdatePet(pet); + //Assert.IsType(response); + } + + /// + /// Test UpdatePetWithForm + /// + [Fact] + public void UpdatePetWithFormTest() + { + // TODO uncomment below to test the method and replace null with proper value + //long petId = null; + //string name = null; + //string status = null; + //instance.UpdatePetWithForm(petId, name, status); + } + + /// + /// Test UploadFile + /// + [Fact] + public void UploadFileTest() + { + // TODO uncomment below to test the method and replace null with proper value + //long petId = null; + //string additionalMetadata = null; + //System.IO.Stream file = null; + //var response = instance.UploadFile(petId, additionalMetadata, file); + //Assert.IsType(response); + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs new file mode 100644 index 00000000000..6c99ad95134 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using Xunit; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +// uncomment below to import models +//using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing StoreApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + public class StoreApiTests : IDisposable + { + private StoreApi instance; + + public StoreApiTests() + { + instance = new StoreApi(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of StoreApi + /// + [Fact] + public void InstanceTest() + { + // TODO uncomment below to test 'IsType' StoreApi + //Assert.IsType(instance); + } + + /// + /// Test DeleteOrder + /// + [Fact] + public void DeleteOrderTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string orderId = null; + //instance.DeleteOrder(orderId); + } + + /// + /// Test GetInventory + /// + [Fact] + public void GetInventoryTest() + { + // TODO uncomment below to test the method and replace null with proper value + //var response = instance.GetInventory(); + //Assert.IsType>(response); + } + + /// + /// Test GetOrderById + /// + [Fact] + public void GetOrderByIdTest() + { + // TODO uncomment below to test the method and replace null with proper value + //long orderId = null; + //var response = instance.GetOrderById(orderId); + //Assert.IsType(response); + } + + /// + /// Test PlaceOrder + /// + [Fact] + public void PlaceOrderTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Order order = null; + //var response = instance.PlaceOrder(order); + //Assert.IsType(response); + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/UserApiTests.cs new file mode 100644 index 00000000000..3f38396769e --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Api/UserApiTests.cs @@ -0,0 +1,148 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using Xunit; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +// uncomment below to import models +//using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing UserApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + public class UserApiTests : IDisposable + { + private UserApi instance; + + public UserApiTests() + { + instance = new UserApi(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of UserApi + /// + [Fact] + public void InstanceTest() + { + // TODO uncomment below to test 'IsType' UserApi + //Assert.IsType(instance); + } + + /// + /// Test CreateUser + /// + [Fact] + public void CreateUserTest() + { + // TODO uncomment below to test the method and replace null with proper value + //User user = null; + //instance.CreateUser(user); + } + + /// + /// Test CreateUsersWithArrayInput + /// + [Fact] + public void CreateUsersWithArrayInputTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List user = null; + //instance.CreateUsersWithArrayInput(user); + } + + /// + /// Test CreateUsersWithListInput + /// + [Fact] + public void CreateUsersWithListInputTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List user = null; + //instance.CreateUsersWithListInput(user); + } + + /// + /// Test DeleteUser + /// + [Fact] + public void DeleteUserTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string username = null; + //instance.DeleteUser(username); + } + + /// + /// Test GetUserByName + /// + [Fact] + public void GetUserByNameTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string username = null; + //var response = instance.GetUserByName(username); + //Assert.IsType(response); + } + + /// + /// Test LoginUser + /// + [Fact] + public void LoginUserTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string username = null; + //string password = null; + //var response = instance.LoginUser(username, password); + //Assert.IsType(response); + } + + /// + /// Test LogoutUser + /// + [Fact] + public void LogoutUserTest() + { + // TODO uncomment below to test the method and replace null with proper value + //instance.LogoutUser(); + } + + /// + /// Test UpdateUser + /// + [Fact] + public void UpdateUserTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string username = null; + //User user = null; + //instance.UpdateUser(username, user); + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs new file mode 100644 index 00000000000..54c455c8af1 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs @@ -0,0 +1,86 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ApiResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ApiResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ApiResponse + //private ApiResponse instance; + + public ApiResponseTests() + { + // TODO uncomment below to create an instance of ApiResponse + //instance = new ApiResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ApiResponse + /// + [Fact] + public void ApiResponseInstanceTest() + { + // TODO uncomment below to test "IsType" ApiResponse + //Assert.IsType(instance); + } + + + /// + /// Test the property 'Code' + /// + [Fact] + public void CodeTest() + { + // TODO unit test for the property 'Code' + } + /// + /// Test the property 'Type' + /// + [Fact] + public void TypeTest() + { + // TODO unit test for the property 'Type' + } + /// + /// Test the property 'Message' + /// + [Fact] + public void MessageTest() + { + // TODO unit test for the property 'Message' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs new file mode 100644 index 00000000000..973015d694e --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -0,0 +1,78 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Category + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CategoryTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Category + //private Category instance; + + public CategoryTests() + { + // TODO uncomment below to create an instance of Category + //instance = new Category(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Category + /// + [Fact] + public void CategoryInstanceTest() + { + // TODO uncomment below to test "IsType" Category + //Assert.IsType(instance); + } + + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs new file mode 100644 index 00000000000..0cc1e616df4 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/OrderTests.cs @@ -0,0 +1,110 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Order + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OrderTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Order + //private Order instance; + + public OrderTests() + { + // TODO uncomment below to create an instance of Order + //instance = new Order(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Order + /// + [Fact] + public void OrderInstanceTest() + { + // TODO uncomment below to test "IsType" Order + //Assert.IsType(instance); + } + + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// + /// Test the property 'PetId' + /// + [Fact] + public void PetIdTest() + { + // TODO unit test for the property 'PetId' + } + /// + /// Test the property 'Quantity' + /// + [Fact] + public void QuantityTest() + { + // TODO unit test for the property 'Quantity' + } + /// + /// Test the property 'ShipDate' + /// + [Fact] + public void ShipDateTest() + { + // TODO unit test for the property 'ShipDate' + } + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + /// + /// Test the property 'Complete' + /// + [Fact] + public void CompleteTest() + { + // TODO unit test for the property 'Complete' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/PetTests.cs new file mode 100644 index 00000000000..a296ab12b4c --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -0,0 +1,110 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Pet + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PetTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Pet + //private Pet instance; + + public PetTests() + { + // TODO uncomment below to create an instance of Pet + //instance = new Pet(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Pet + /// + [Fact] + public void PetInstanceTest() + { + // TODO uncomment below to test "IsType" Pet + //Assert.IsType(instance); + } + + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// + /// Test the property 'Category' + /// + [Fact] + public void CategoryTest() + { + // TODO unit test for the property 'Category' + } + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + /// + /// Test the property 'PhotoUrls' + /// + [Fact] + public void PhotoUrlsTest() + { + // TODO unit test for the property 'PhotoUrls' + } + /// + /// Test the property 'Tags' + /// + [Fact] + public void TagsTest() + { + // TODO unit test for the property 'Tags' + } + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/TagTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/TagTests.cs new file mode 100644 index 00000000000..d3b4766b104 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/TagTests.cs @@ -0,0 +1,78 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Tag + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TagTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Tag + //private Tag instance; + + public TagTests() + { + // TODO uncomment below to create an instance of Tag + //instance = new Tag(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Tag + /// + [Fact] + public void TagInstanceTest() + { + // TODO uncomment below to test "IsType" Tag + //Assert.IsType(instance); + } + + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/UserTests.cs new file mode 100644 index 00000000000..b7019235bfe --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/UserTests.cs @@ -0,0 +1,126 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing User + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class UserTests : IDisposable + { + // TODO uncomment below to declare an instance variable for User + //private User instance; + + public UserTests() + { + // TODO uncomment below to create an instance of User + //instance = new User(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of User + /// + [Fact] + public void UserInstanceTest() + { + // TODO uncomment below to test "IsType" User + //Assert.IsType(instance); + } + + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// + /// Test the property 'Username' + /// + [Fact] + public void UsernameTest() + { + // TODO unit test for the property 'Username' + } + /// + /// Test the property 'FirstName' + /// + [Fact] + public void FirstNameTest() + { + // TODO unit test for the property 'FirstName' + } + /// + /// Test the property 'LastName' + /// + [Fact] + public void LastNameTest() + { + // TODO unit test for the property 'LastName' + } + /// + /// Test the property 'Email' + /// + [Fact] + public void EmailTest() + { + // TODO unit test for the property 'Email' + } + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + /// + /// Test the property 'Phone' + /// + [Fact] + public void PhoneTest() + { + // TODO unit test for the property 'Phone' + } + /// + /// Test the property 'UserStatus' + /// + [Fact] + public void UserStatusTest() + { + // TODO unit test for the property 'UserStatus' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 00000000000..2a44951991c --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net5.0 + false + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/PetApi.cs new file mode 100644 index 00000000000..34913501ea0 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -0,0 +1,1572 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Pet + Pet AddPet(Pet pet); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// ApiResponse of Pet + ApiResponse AddPetWithHttpInfo(Pet pet); + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// + void DeletePet(long petId, string apiKey = default(string)); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// ApiResponse of Object(void) + ApiResponse DeletePetWithHttpInfo(long petId, string apiKey = default(string)); + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// List<Pet> + List FindPetsByStatus(List status); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// ApiResponse of List<Pet> + ApiResponse> FindPetsByStatusWithHttpInfo(List status); + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// List<Pet> + List FindPetsByTags(List tags); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// ApiResponse of List<Pet> + ApiResponse> FindPetsByTagsWithHttpInfo(List tags); + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Pet + Pet GetPetById(long petId); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// ApiResponse of Pet + ApiResponse GetPetByIdWithHttpInfo(long petId); + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Pet + Pet UpdatePet(Pet pet); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// ApiResponse of Pet + ApiResponse UpdatePetWithHttpInfo(Pet pet); + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// + void UpdatePetWithForm(long petId, string name = default(string), string status = default(string)); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// ApiResponse of Object(void) + ApiResponse UpdatePetWithFormWithHttpInfo(long petId, string name = default(string), string status = default(string)); + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// ApiResponse + ApiResponse UploadFile(long petId, string additionalMetadata = default(string), System.IO.Stream file = default(System.IO.Stream)); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithHttpInfo(long petId, string additionalMetadata = default(string), System.IO.Stream file = default(System.IO.Stream)); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// Task of Pet + System.Threading.Tasks.Task AddPetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Pet) + System.Threading.Tasks.Task> AddPetWithHttpInfoAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task DeletePetAsync(long petId, string apiKey = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> DeletePetWithHttpInfoAsync(long petId, string apiKey = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + System.Threading.Tasks.Task> FindPetsByStatusAsync(List status, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + System.Threading.Tasks.Task>> FindPetsByStatusWithHttpInfoAsync(List status, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + System.Threading.Tasks.Task> FindPetsByTagsAsync(List tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + System.Threading.Tasks.Task>> FindPetsByTagsWithHttpInfoAsync(List tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// Task of Pet + System.Threading.Tasks.Task GetPetByIdAsync(long petId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Pet) + System.Threading.Tasks.Task> GetPetByIdWithHttpInfoAsync(long petId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// Task of Pet + System.Threading.Tasks.Task UpdatePetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Pet) + System.Threading.Tasks.Task> UpdatePetWithHttpInfoAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task UpdatePetWithFormAsync(long petId, string name = default(string), string status = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> UpdatePetWithFormWithHttpInfoAsync(long petId, string name = default(string), string status = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task UploadFileAsync(long petId, string additionalMetadata = default(string), System.IO.Stream file = default(System.IO.Stream), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ApiResponse) + System.Threading.Tasks.Task> UploadFileWithHttpInfoAsync(long petId, string additionalMetadata = default(string), System.IO.Stream file = default(System.IO.Stream), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApi : IPetApiSync, IPetApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class PetApi : IPetApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi(String basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public PetApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public PetApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Pet + public Pet AddPet(Pet pet) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = AddPetWithHttpInfo(pet); + return localVarResponse.Data; + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// ApiResponse of Pet + public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet) + { + // verify the required parameter 'pet' is set + if (pet == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->AddPet"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = pet; + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/pet", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddPet", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// Task of Pet + public async System.Threading.Tasks.Task AddPetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await AddPetWithHttpInfoAsync(pet, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Pet) + public async System.Threading.Tasks.Task> AddPetWithHttpInfoAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'pet' is set + if (pet == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->AddPet"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = pet; + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/pet", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddPet", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// + public void DeletePet(long petId, string apiKey = default(string)) + { + DeletePetWithHttpInfo(petId, apiKey); + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeletePetWithHttpInfo(long petId, string apiKey = default(string)) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (apiKey != null) + { + localVarRequestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = this.Client.Delete("/pet/{petId}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeletePet", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task DeletePetAsync(long petId, string apiKey = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await DeletePetWithHttpInfoAsync(petId, apiKey, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeletePetWithHttpInfoAsync(long petId, string apiKey = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (apiKey != null) + { + localVarRequestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeletePet", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// List<Pet> + public List FindPetsByStatus(List status) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByStatusWithHttpInfo(status); + return localVarResponse.Data; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// ApiResponse of List<Pet> + public Org.OpenAPITools.Client.ApiResponse> FindPetsByStatusWithHttpInfo(List status) + { + // verify the required parameter 'status' is set + if (status == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = this.Client.Get>("/pet/findByStatus", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + public async System.Threading.Tasks.Task> FindPetsByStatusAsync(List status, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByStatusWithHttpInfoAsync(status, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + public async System.Threading.Tasks.Task>> FindPetsByStatusWithHttpInfoAsync(List status, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'status' is set + if (status == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync>("/pet/findByStatus", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// List<Pet> + public List FindPetsByTags(List tags) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByTagsWithHttpInfo(tags); + return localVarResponse.Data; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// ApiResponse of List<Pet> + public Org.OpenAPITools.Client.ApiResponse> FindPetsByTagsWithHttpInfo(List tags) + { + // verify the required parameter 'tags' is set + if (tags == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = this.Client.Get>("/pet/findByTags", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByTags", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + public async System.Threading.Tasks.Task> FindPetsByTagsAsync(List tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByTagsWithHttpInfoAsync(tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + public async System.Threading.Tasks.Task>> FindPetsByTagsWithHttpInfoAsync(List tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'tags' is set + if (tags == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync>("/pet/findByTags", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByTags", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Pet + public Pet GetPetById(long petId) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetPetByIdWithHttpInfo(petId); + return localVarResponse.Data; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// ApiResponse of Pet + public Org.OpenAPITools.Client.ApiResponse GetPetByIdWithHttpInfo(long petId) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + var localVarResponse = this.Client.Get("/pet/{petId}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPetById", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// Task of Pet + public async System.Threading.Tasks.Task GetPetByIdAsync(long petId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetPetByIdWithHttpInfoAsync(petId, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Pet) + public async System.Threading.Tasks.Task> GetPetByIdWithHttpInfoAsync(long petId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPetById", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Pet + public Pet UpdatePet(Pet pet) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = UpdatePetWithHttpInfo(pet); + return localVarResponse.Data; + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// ApiResponse of Pet + public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet) + { + // verify the required parameter 'pet' is set + if (pet == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->UpdatePet"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = pet; + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = this.Client.Put("/pet", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePet", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// Task of Pet + public async System.Threading.Tasks.Task UpdatePetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await UpdatePetWithHttpInfoAsync(pet, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Pet) + public async System.Threading.Tasks.Task> UpdatePetWithHttpInfoAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'pet' is set + if (pet == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->UpdatePet"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = pet; + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/pet", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePet", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// + public void UpdatePetWithForm(long petId, string name = default(string), string status = default(string)) + { + UpdatePetWithFormWithHttpInfo(petId, name, status); + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse UpdatePetWithFormWithHttpInfo(long petId, string name = default(string), string status = default(string)) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (name != null) + { + localVarRequestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter + } + if (status != null) + { + localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/pet/{petId}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePetWithForm", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task UpdatePetWithFormAsync(long petId, string name = default(string), string status = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await UpdatePetWithFormWithHttpInfoAsync(petId, name, status, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> UpdatePetWithFormWithHttpInfoAsync(long petId, string name = default(string), string status = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (name != null) + { + localVarRequestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter + } + if (status != null) + { + localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePetWithForm", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// ApiResponse + public ApiResponse UploadFile(long petId, string additionalMetadata = default(string), System.IO.Stream file = default(System.IO.Stream)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = UploadFileWithHttpInfo(petId, additionalMetadata, file); + return localVarResponse.Data; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// ApiResponse of ApiResponse + public Org.OpenAPITools.Client.ApiResponse UploadFileWithHttpInfo(long petId, string additionalMetadata = default(string), System.IO.Stream file = default(System.IO.Stream)) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "multipart/form-data" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + if (file != null) + { + localVarRequestOptions.FileParameters.Add("file", file); + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/pet/{petId}/uploadImage", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UploadFile", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task UploadFileAsync(long petId, string additionalMetadata = default(string), System.IO.Stream file = default(System.IO.Stream), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await UploadFileWithHttpInfoAsync(petId, additionalMetadata, file, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ApiResponse) + public async System.Threading.Tasks.Task> UploadFileWithHttpInfoAsync(long petId, string additionalMetadata = default(string), System.IO.Stream file = default(System.IO.Stream), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "multipart/form-data" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/json" + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + if (file != null) + { + localVarRequestOptions.FileParameters.Add("file", file); + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/pet/{petId}/uploadImage", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UploadFile", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/StoreApi.cs new file mode 100644 index 00000000000..d4d37dc9d4d --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/StoreApi.cs @@ -0,0 +1,778 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// + void DeleteOrder(string orderId); + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// ApiResponse of Object(void) + ApiResponse DeleteOrderWithHttpInfo(string orderId); + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Dictionary<string, int> + Dictionary GetInventory(); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// ApiResponse of Dictionary<string, int> + ApiResponse> GetInventoryWithHttpInfo(); + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Order + Order GetOrderById(long orderId); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// ApiResponse of Order + ApiResponse GetOrderByIdWithHttpInfo(long orderId); + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Order + Order PlaceOrder(Order order); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// ApiResponse of Order + ApiResponse PlaceOrderWithHttpInfo(Order order); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task DeleteOrderAsync(string orderId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> DeleteOrderWithHttpInfoAsync(string orderId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, int> + System.Threading.Tasks.Task> GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, int>) + System.Threading.Tasks.Task>> GetInventoryWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// Task of Order + System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + System.Threading.Tasks.Task> GetOrderByIdWithHttpInfoAsync(long orderId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// Task of Order + System.Threading.Tasks.Task PlaceOrderAsync(Order order, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + System.Threading.Tasks.Task> PlaceOrderWithHttpInfoAsync(Order order, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApi : IStoreApiSync, IStoreApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class StoreApi : IStoreApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi(String basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public StoreApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public StoreApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// + public void DeleteOrder(string orderId) + { + DeleteOrderWithHttpInfo(orderId); + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeleteOrderWithHttpInfo(string orderId) + { + // verify the required parameter 'orderId' is set + if (orderId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("orderId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/store/order/{orderId}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteOrder", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task DeleteOrderAsync(string orderId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await DeleteOrderWithHttpInfoAsync(orderId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeleteOrderWithHttpInfoAsync(string orderId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'orderId' is set + if (orderId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("orderId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/store/order/{orderId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteOrder", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Dictionary<string, int> + public Dictionary GetInventory() + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = GetInventoryWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// ApiResponse of Dictionary<string, int> + public Org.OpenAPITools.Client.ApiResponse> GetInventoryWithHttpInfo() + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + var localVarResponse = this.Client.Get>("/store/inventory", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, int> + public async System.Threading.Tasks.Task> GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await GetInventoryWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, int>) + public async System.Threading.Tasks.Task>> GetInventoryWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/json" + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync>("/store/inventory", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Order + public Order GetOrderById(long orderId) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetOrderByIdWithHttpInfo(orderId); + return localVarResponse.Data; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// ApiResponse of Order + public Org.OpenAPITools.Client.ApiResponse GetOrderByIdWithHttpInfo(long orderId) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("orderId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + + // make the HTTP request + var localVarResponse = this.Client.Get("/store/order/{orderId}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetOrderById", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// Task of Order + public async System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetOrderByIdWithHttpInfoAsync(orderId, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + public async System.Threading.Tasks.Task> GetOrderByIdWithHttpInfoAsync(long orderId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("orderId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/store/order/{orderId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetOrderById", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Order + public Order PlaceOrder(Order order) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = PlaceOrderWithHttpInfo(order); + return localVarResponse.Data; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// ApiResponse of Order + public Org.OpenAPITools.Client.ApiResponse PlaceOrderWithHttpInfo(Order order) + { + // verify the required parameter 'order' is set + if (order == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = order; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/store/order", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("PlaceOrder", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// Task of Order + public async System.Threading.Tasks.Task PlaceOrderAsync(Order order, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await PlaceOrderWithHttpInfoAsync(order, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + public async System.Threading.Tasks.Task> PlaceOrderWithHttpInfoAsync(Order order, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'order' is set + if (order == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = order; + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/store/order", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("PlaceOrder", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/UserApi.cs new file mode 100644 index 00000000000..8e6455d1b99 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/UserApi.cs @@ -0,0 +1,1482 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// + void CreateUser(User user); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// ApiResponse of Object(void) + ApiResponse CreateUserWithHttpInfo(User user); + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// + void CreateUsersWithArrayInput(List user); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// ApiResponse of Object(void) + ApiResponse CreateUsersWithArrayInputWithHttpInfo(List user); + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// + void CreateUsersWithListInput(List user); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// ApiResponse of Object(void) + ApiResponse CreateUsersWithListInputWithHttpInfo(List user); + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// + void DeleteUser(string username); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// ApiResponse of Object(void) + ApiResponse DeleteUserWithHttpInfo(string username); + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// User + User GetUserByName(string username); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// ApiResponse of User + ApiResponse GetUserByNameWithHttpInfo(string username); + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// string + string LoginUser(string username, string password); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// ApiResponse of string + ApiResponse LoginUserWithHttpInfo(string username, string password); + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// + void LogoutUser(); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ApiResponse of Object(void) + ApiResponse LogoutUserWithHttpInfo(); + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// + void UpdateUser(string username, User user); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// ApiResponse of Object(void) + ApiResponse UpdateUserWithHttpInfo(string username, User user); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task CreateUserAsync(User user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUserWithHttpInfoAsync(User user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task CreateUsersWithArrayInputAsync(List user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUsersWithArrayInputWithHttpInfoAsync(List user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task CreateUsersWithListInputAsync(List user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUsersWithListInputWithHttpInfoAsync(List user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task DeleteUserAsync(string username, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> DeleteUserWithHttpInfoAsync(string username, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// Task of User + System.Threading.Tasks.Task GetUserByNameAsync(string username, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (User) + System.Threading.Tasks.Task> GetUserByNameWithHttpInfoAsync(string username, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Cancellation Token to cancel the request. + /// Task of string + System.Threading.Tasks.Task LoginUserAsync(string username, string password, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + System.Threading.Tasks.Task> LoginUserWithHttpInfoAsync(string username, string password, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task LogoutUserAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> LogoutUserWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task UpdateUserAsync(string username, User user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> UpdateUserWithHttpInfoAsync(string username, User user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApi : IUserApiSync, IUserApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class UserApi : IUserApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi(String basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public UserApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public UserApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// + public void CreateUser(User user) + { + CreateUserWithHttpInfo(user); + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUserWithHttpInfo(User user) + { + // verify the required parameter 'user' is set + if (user == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUser"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = user; + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/user", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUser", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task CreateUserAsync(User user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await CreateUserWithHttpInfoAsync(user, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUserWithHttpInfoAsync(User user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'user' is set + if (user == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUser"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = user; + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/user", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUser", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// + public void CreateUsersWithArrayInput(List user) + { + CreateUsersWithArrayInputWithHttpInfo(user); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUsersWithArrayInputWithHttpInfo(List user) + { + // verify the required parameter 'user' is set + if (user == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithArrayInput"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = user; + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/user/createWithArray", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task CreateUsersWithArrayInputAsync(List user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await CreateUsersWithArrayInputWithHttpInfoAsync(user, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUsersWithArrayInputWithHttpInfoAsync(List user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'user' is set + if (user == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithArrayInput"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = user; + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/user/createWithArray", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// + public void CreateUsersWithListInput(List user) + { + CreateUsersWithListInputWithHttpInfo(user); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUsersWithListInputWithHttpInfo(List user) + { + // verify the required parameter 'user' is set + if (user == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithListInput"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = user; + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/user/createWithList", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithListInput", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task CreateUsersWithListInputAsync(List user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await CreateUsersWithListInputWithHttpInfoAsync(user, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUsersWithListInputWithHttpInfoAsync(List user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'user' is set + if (user == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithListInput"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = user; + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/user/createWithList", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithListInput", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// + public void DeleteUser(string username) + { + DeleteUserWithHttpInfo(username); + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeleteUserWithHttpInfo(string username) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + var localVarResponse = this.Client.Delete("/user/{username}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteUser", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task DeleteUserAsync(string username, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await DeleteUserWithHttpInfoAsync(username, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeleteUserWithHttpInfoAsync(string username, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteUser", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// User + public User GetUserByName(string username) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetUserByNameWithHttpInfo(username); + return localVarResponse.Data; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// ApiResponse of User + public Org.OpenAPITools.Client.ApiResponse GetUserByNameWithHttpInfo(string username) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + + // make the HTTP request + var localVarResponse = this.Client.Get("/user/{username}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUserByName", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// Task of User + public async System.Threading.Tasks.Task GetUserByNameAsync(string username, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetUserByNameWithHttpInfoAsync(username, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (User) + public async System.Threading.Tasks.Task> GetUserByNameWithHttpInfoAsync(string username, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUserByName", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// string + public string LoginUser(string username, string password) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = LoginUserWithHttpInfo(username, password); + return localVarResponse.Data; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// ApiResponse of string + public Org.OpenAPITools.Client.ApiResponse LoginUserWithHttpInfo(string username, string password) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); + + // verify the required parameter 'password' is set + if (password == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); + + + // make the HTTP request + var localVarResponse = this.Client.Get("/user/login", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LoginUser", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Cancellation Token to cancel the request. + /// Task of string + public async System.Threading.Tasks.Task LoginUserAsync(string username, string password, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await LoginUserWithHttpInfoAsync(username, password, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + public async System.Threading.Tasks.Task> LoginUserWithHttpInfoAsync(string username, string password, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); + + // verify the required parameter 'password' is set + if (password == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + "application/xml", + "application/json" + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/user/login", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LoginUser", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// + public void LogoutUser() + { + LogoutUserWithHttpInfo(); + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse LogoutUserWithHttpInfo() + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + var localVarResponse = this.Client.Get("/user/logout", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LogoutUser", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task LogoutUserAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await LogoutUserWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> LogoutUserWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/user/logout", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LogoutUser", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// + public void UpdateUser(string username, User user) + { + UpdateUserWithHttpInfo(username, user); + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse UpdateUserWithHttpInfo(string username, User user) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); + + // verify the required parameter 'user' is set + if (user == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->UpdateUser"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.Data = user; + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + var localVarResponse = this.Client.Put("/user/{username}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateUser", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task UpdateUserAsync(string username, User user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await UpdateUserWithHttpInfoAsync(username, user, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> UpdateUserWithHttpInfoAsync(string username, User user, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); + + // verify the required parameter 'user' is set + if (user == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->UpdateUser"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] _contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] _accepts = new String[] { + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.Data = user; + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateUser", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs new file mode 100644 index 00000000000..5c4b6465dbc --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs @@ -0,0 +1,835 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Web; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RestSharp; +using RestSharp.Deserializers; +using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; +using RestSharpMethod = RestSharp.Method; +using Polly; + +namespace Org.OpenAPITools.Client +{ + /// + /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec : RestSharp.Serializers.ISerializer, RestSharp.Deserializers.IDeserializer + { + private readonly IReadableConfiguration _configuration; + private static readonly string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is Org.OpenAPITools.Model.AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((Org.OpenAPITools.Model.AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public T Deserialize(IRestResponse response) + { + var result = (T)Deserialize(response, typeof(T)); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal object Deserialize(IRestResponse response, Type type) + { + IList headers = response.Headers; + if (type == typeof(byte[])) // return byte array + { + return response.RawBytes; + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + if (headers != null) + { + var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, response.RawBytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(response.RawBytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(response.Content, null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(response.Content, type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementatios), + /// encapsulating general REST accessor use cases. + /// + public partial class ApiClient : ISynchronousClient, IAsynchronousClient + { + private readonly String _baseUrl; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accomodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(IRestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(IRestRequest request, IRestResponse response); + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + public ApiClient() + { + _baseUrl = Org.OpenAPITools.Client.GlobalConfiguration.Instance.BasePath; + } + + /// + /// Initializes a new instance of the + /// + /// The target service's base path in URL format. + /// + public ApiClient(String basePath) + { + if (string.IsNullOrEmpty(basePath)) + throw new ArgumentException("basePath cannot be empty"); + + _baseUrl = basePath; + } + + /// + /// Constructs the RestSharp version of an http method + /// + /// Swagger Client Custom HttpMethod + /// RestSharp's HttpMethod instance. + /// + private RestSharpMethod Method(HttpMethod method) + { + RestSharpMethod other; + switch (method) + { + case HttpMethod.Get: + other = RestSharpMethod.GET; + break; + case HttpMethod.Post: + other = RestSharpMethod.POST; + break; + case HttpMethod.Put: + other = RestSharpMethod.PUT; + break; + case HttpMethod.Delete: + other = RestSharpMethod.DELETE; + break; + case HttpMethod.Head: + other = RestSharpMethod.HEAD; + break; + case HttpMethod.Options: + other = RestSharpMethod.OPTIONS; + break; + case HttpMethod.Patch: + other = RestSharpMethod.PATCH; + break; + default: + throw new ArgumentOutOfRangeException("method", method, null); + } + + return other; + } + + /// + /// Provides all logic for constructing a new RestSharp . + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the RestSharp request. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new RestRequest instance. + /// + private RestRequest NewRequest( + HttpMethod method, + String path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + RestRequest request = new RestRequest(Method(method)) + { + Resource = path, + JsonSerializer = new CustomJsonCodec(SerializerSettings, configuration) + }; + + if (options.PathParameters != null) + { + foreach (var pathParam in options.PathParameters) + { + request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); + } + } + + if (options.QueryParameters != null) + { + foreach (var queryParam in options.QueryParameters) + { + foreach (var value in queryParam.Value) + { + request.AddQueryParameter(queryParam.Key, value); + } + } + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.AddHeader(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + request.AddHeader(headerParam.Key, value); + } + } + } + + if (options.FormParameters != null) + { + foreach (var formParam in options.FormParameters) + { + request.AddParameter(formParam.Key, formParam.Value); + } + } + + if (options.Data != null) + { + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) + { + request.RequestFormat = DataFormat.Json; + } + else + { + // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. + } + } + else + { + // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. + request.RequestFormat = DataFormat.Json; + } + + request.AddJsonBody(options.Data); + } + + if (options.FileParameters != null) + { + foreach (var fileParam in options.FileParameters) + { + var bytes = ClientUtils.ReadAsBytes(fileParam.Value); + var fileStream = fileParam.Value as FileStream; + if (fileStream != null) + request.Files.Add(FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name))); + else + request.Files.Add(FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided")); + } + } + + if (options.Cookies != null && options.Cookies.Count > 0) + { + foreach (var cookie in options.Cookies) + { + request.AddCookie(cookie.Name, cookie.Value); + } + } + + return request; + } + + private ApiResponse ToApiResponse(IRestResponse response) + { + T result = response.Data; + string rawContent = response.Content; + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ErrorMessage, + Cookies = new List() + }; + + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.Cookies != null) + { + foreach (var responseCookies in response.Cookies) + { + transformed.Cookies.Add( + new Cookie( + responseCookies.Name, + responseCookies.Value, + responseCookies.Path, + responseCookies.Domain) + ); + } + } + + return transformed; + } + + private ApiResponse Exec(RestRequest req, IReadableConfiguration configuration) + { + RestClient client = new RestClient(_baseUrl); + + client.ClearHandlers(); + var existingDeserializer = req.JsonSerializer as IDeserializer; + if (existingDeserializer != null) + { + client.AddHandler("application/json", () => existingDeserializer); + client.AddHandler("text/json", () => existingDeserializer); + client.AddHandler("text/x-json", () => existingDeserializer); + client.AddHandler("text/javascript", () => existingDeserializer); + client.AddHandler("*+json", () => existingDeserializer); + } + else + { + var customDeserializer = new CustomJsonCodec(SerializerSettings, configuration); + client.AddHandler("application/json", () => customDeserializer); + client.AddHandler("text/json", () => customDeserializer); + client.AddHandler("text/x-json", () => customDeserializer); + client.AddHandler("text/javascript", () => customDeserializer); + client.AddHandler("*+json", () => customDeserializer); + } + + var xmlDeserializer = new XmlDeserializer(); + client.AddHandler("application/xml", () => xmlDeserializer); + client.AddHandler("text/xml", () => xmlDeserializer); + client.AddHandler("*+xml", () => xmlDeserializer); + client.AddHandler("*", () => xmlDeserializer); + + client.Timeout = configuration.Timeout; + + if (configuration.Proxy != null) + { + client.Proxy = configuration.Proxy; + } + + if (configuration.UserAgent != null) + { + client.UserAgent = configuration.UserAgent; + } + + if (configuration.ClientCertificates != null) + { + client.ClientCertificates = configuration.ClientCertificates; + } + + InterceptRequest(req); + + IRestResponse response; + if (RetryConfiguration.RetryPolicy != null) + { + var policy = RetryConfiguration.RetryPolicy; + var policyResult = policy.ExecuteAndCapture(() => client.Execute(req)); + response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse + { + Request = req, + ErrorException = policyResult.FinalException + }; + } + else + { + response = client.Execute(req); + } + + InterceptResponse(req, response); + + var result = ToApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + + if (response.Cookies != null && response.Cookies.Count > 0) + { + if (result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + + result.Cookies.Add(cookie); + } + } + return result; + } + + private async Task> ExecAsync(RestRequest req, IReadableConfiguration configuration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + RestClient client = new RestClient(_baseUrl); + + client.ClearHandlers(); + var existingDeserializer = req.JsonSerializer as IDeserializer; + if (existingDeserializer != null) + { + client.AddHandler("application/json", () => existingDeserializer); + client.AddHandler("text/json", () => existingDeserializer); + client.AddHandler("text/x-json", () => existingDeserializer); + client.AddHandler("text/javascript", () => existingDeserializer); + client.AddHandler("*+json", () => existingDeserializer); + } + else + { + var customDeserializer = new CustomJsonCodec(SerializerSettings, configuration); + client.AddHandler("application/json", () => customDeserializer); + client.AddHandler("text/json", () => customDeserializer); + client.AddHandler("text/x-json", () => customDeserializer); + client.AddHandler("text/javascript", () => customDeserializer); + client.AddHandler("*+json", () => customDeserializer); + } + + var xmlDeserializer = new XmlDeserializer(); + client.AddHandler("application/xml", () => xmlDeserializer); + client.AddHandler("text/xml", () => xmlDeserializer); + client.AddHandler("*+xml", () => xmlDeserializer); + client.AddHandler("*", () => xmlDeserializer); + + client.Timeout = configuration.Timeout; + + if (configuration.Proxy != null) + { + client.Proxy = configuration.Proxy; + } + + if (configuration.UserAgent != null) + { + client.UserAgent = configuration.UserAgent; + } + + if (configuration.ClientCertificates != null) + { + client.ClientCertificates = configuration.ClientCertificates; + } + + InterceptRequest(req); + + IRestResponse response; + if (RetryConfiguration.AsyncRetryPolicy != null) + { + var policy = RetryConfiguration.AsyncRetryPolicy; + var policyResult = await policy.ExecuteAndCaptureAsync(() => client.ExecuteAsync(req, cancellationToken)).ConfigureAwait(false); + response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse + { + Request = req, + ErrorException = policyResult.FinalException + }; + } + else + { + response = await client.ExecuteAsync(req, cancellationToken).ConfigureAwait(false); + } + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + T instance = (T)Activator.CreateInstance(typeof(T)); + MethodInfo method = typeof(T).GetMethod("FromJson"); + method.Invoke(instance, new object[] { response.Content }); + response.Data = instance; + } + + InterceptResponse(req, response); + + var result = ToApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + + if (response.Cookies != null && response.Cookies.Count > 0) + { + if (result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + + result.Cookies.Add(cookie); + } + } + return result; + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Patch, path, options, config), config); + } + #endregion ISynchronousClient + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 00000000000..dcc378ad208 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiException.cs @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiResponse.cs new file mode 100644 index 00000000000..57a13978ecb --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiResponse.cs @@ -0,0 +1,166 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + String ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public String ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 00000000000..fd0d02973fe --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,228 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using KellermanSoftware.CompareNetObjects; + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// An instance of CompareLogic. + /// + public static CompareLogic compareLogic; + + /// + /// Static contstructor to initialise compareLogic. + /// + static ClientUtils() + { + compareLogic = new CompareLogic(); + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) + return string.Join(",", collection.Cast()); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// String to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// String to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static String SelectHeaderContentType(String[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static String SelectHeaderAccept(String[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return String.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(String mime) + { + if (String.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Configuration.cs new file mode 100644 index 00000000000..1bde137e17a --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Configuration.cs @@ -0,0 +1,520 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; + +namespace Org.OpenAPITools.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + if (status == 0) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.ErrorText), response.ErrorText); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private String _basePath; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for acessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; + BasePath = "http://petstore.swagger.io/v2"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "http://petstore.swagger.io/v2"}, + {"description", "No description provided"}, + } + } + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "http://petstore.swagger.io/v2") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public virtual string Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public virtual string Password { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets certificate collection to be sent with requests. + /// + /// X509 Certificate collection. + public X509CertificateCollection ClientCertificates { get; set; } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// This helper property simplifies code generation. + /// + /// The access token. + public virtual string AccessToken { get; set; } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + if (index < 0 || index >= Servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {Servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = Servers[index]; + string url = (string)server["url"]; + + // go through variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use defualt value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + + return url; + } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static String ToDebugReport() + { + String report = "C# SDK (Org.OpenAPITools) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + Username = second.Username ?? first.Username, + Password = second.Password ?? first.Password, + AccessToken = second.AccessToken ?? first.AccessToken, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat + }; + return config; + } + #endregion Static Members + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ExceptionFactory.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ExceptionFactory.cs new file mode 100644 index 00000000000..6ae2a10aae4 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ExceptionFactory.cs @@ -0,0 +1,22 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/GlobalConfiguration.cs new file mode 100644 index 00000000000..e1c00c89a03 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/GlobalConfiguration.cs @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/HttpMethod.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/HttpMethod.cs new file mode 100644 index 00000000000..1dd692d8cfb --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/HttpMethod.cs @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +namespace Org.OpenAPITools.Client +{ + /// + /// Http methods supported by swagger + /// + public enum HttpMethod + { + /// HTTP GET request. + Get, + /// HTTP POST request. + Post, + /// HTTP PUT request. + Put, + /// HTTP DELETE request. + Delete, + /// HTTP HEAD request. + Head, + /// HTTP OPTIONS request. + Options, + /// HTTP PATCH request. + Patch + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IApiAccessor.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IApiAccessor.cs new file mode 100644 index 00000000000..edcf9827ebb --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IApiAccessor.cs @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Represents configuration aspects required to interact with the API endpoints. + /// + public interface IApiAccessor + { + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + IReadableConfiguration Configuration { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + String GetBasePath(); + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + ExceptionFactory ExceptionFactory { get; set; } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IAsynchronousClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IAsynchronousClient.cs new file mode 100644 index 00000000000..6b62316325d --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IAsynchronousClient.cs @@ -0,0 +1,100 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(String path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IReadableConfiguration.cs new file mode 100644 index 00000000000..00bedba8ee2 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IReadableConfiguration.cs @@ -0,0 +1,115 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Net; +using System.Security.Cryptography.X509Certificates; + +namespace Org.OpenAPITools.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the access token. + /// + /// Access token. + string AccessToken { get; } + + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time foramt. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Gets the username. + /// + /// Username. + string Username { get; } + + /// + /// Gets the password. + /// + /// Password. + string Password { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets certificate collection to be sent with requests. + /// + /// X509 Certificate collection. + X509CertificateCollection ClientCertificates { get; } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ISynchronousClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ISynchronousClient.cs new file mode 100644 index 00000000000..22bb7a560f7 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ISynchronousClient.cs @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.IO; + +namespace Org.OpenAPITools.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(String path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Multimap.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Multimap.cs new file mode 100644 index 00000000000..966d634a50b --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Multimap.cs @@ -0,0 +1,295 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs new file mode 100644 index 00000000000..dcc79edd944 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs @@ -0,0 +1,29 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using Newtonsoft.Json.Converters; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/RequestOptions.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/RequestOptions.cs new file mode 100644 index 00000000000..e5facdfdaf8 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/RequestOptions.cs @@ -0,0 +1,74 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Dictionary FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Dictionary(); + Cookies = new List(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/RetryConfiguration.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/RetryConfiguration.cs new file mode 100644 index 00000000000..c93633a36d9 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/RetryConfiguration.cs @@ -0,0 +1,21 @@ +using Polly; +using RestSharp; + +namespace Org.OpenAPITools.Client +{ + /// + /// Configuration class to set the polly retry policies to be applied to the requests. + /// + public class RetryConfiguration + { + /// + /// Retry policy + /// + public static Policy RetryPolicy { get; set; } + + /// + /// Async retry policy + /// + public static AsyncPolicy AsyncRetryPolicy { get; set; } + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs new file mode 100644 index 00000000000..675bb752f4b --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Org.OpenAPITools.Model +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ApiResponse.cs new file mode 100644 index 00000000000..5bf6b7b9b79 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -0,0 +1,149 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Describes the result of uploading an image resource + /// + [DataContract(Name = "ApiResponse")] + public partial class ApiResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// code. + /// type. + /// message. + public ApiResponse(int code = default(int), string type = default(string), string message = default(string)) + { + this.Code = code; + this.Type = type; + this.Message = message; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Code + /// + [DataMember(Name = "code", EmitDefaultValue = false)] + public int Code { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = false)] + public string Type { get; set; } + + /// + /// Gets or Sets Message + /// + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ApiResponse {\n"); + sb.Append(" Code: ").Append(Code).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ApiResponse).AreEqual; + } + + /// + /// Returns true if ApiResponse instances are equal + /// + /// Instance of ApiResponse to be compared + /// Boolean + public bool Equals(ApiResponse input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = hashCode * 59 + this.Code.GetHashCode(); + if (this.Type != null) + hashCode = hashCode * 59 + this.Type.GetHashCode(); + if (this.Message != null) + hashCode = hashCode * 59 + this.Message.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Category.cs new file mode 100644 index 00000000000..dff8136d1c1 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Category.cs @@ -0,0 +1,145 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// A category for a pet + /// + [DataContract(Name = "Category")] + public partial class Category : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id. + /// name. + public Category(long id = default(long), string name = default(string)) + { + this.Id = id; + this.Name = name; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", EmitDefaultValue = false)] + public long Id { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", EmitDefaultValue = false)] + public string Name { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Category {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as Category).AreEqual; + } + + /// + /// Returns true if Category instances are equal + /// + /// Instance of Category to be compared + /// Boolean + public bool Equals(Category input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = hashCode * 59 + this.Id.GetHashCode(); + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Name (string) pattern + Regex regexName = new Regex(@"^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$", RegexOptions.CultureInvariant); + if (false == regexName.Match(this.Name).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Name, must match a pattern of " + regexName, new [] { "Name" }); + } + + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Order.cs new file mode 100644 index 00000000000..10b83e0a24d --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Order.cs @@ -0,0 +1,205 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// An order for a pets from the pet store + /// + [DataContract(Name = "Order")] + public partial class Order : IEquatable, IValidatableObject + { + /// + /// Order Status + /// + /// Order Status + [JsonConverter(typeof(StringEnumConverter))] + public enum StatusEnum + { + /// + /// Enum Placed for value: placed + /// + [EnumMember(Value = "placed")] + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + [EnumMember(Value = "approved")] + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + [EnumMember(Value = "delivered")] + Delivered = 3 + + } + + /// + /// Order Status + /// + /// Order Status + [DataMember(Name = "status", EmitDefaultValue = false)] + public StatusEnum? Status { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// id. + /// petId. + /// quantity. + /// shipDate. + /// Order Status. + /// complete (default to false). + public Order(long id = default(long), long petId = default(long), int quantity = default(int), DateTime shipDate = default(DateTime), StatusEnum? status = default(StatusEnum?), bool complete = false) + { + this.Id = id; + this.PetId = petId; + this.Quantity = quantity; + this.ShipDate = shipDate; + this.Status = status; + this.Complete = complete; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", EmitDefaultValue = false)] + public long Id { get; set; } + + /// + /// Gets or Sets PetId + /// + [DataMember(Name = "petId", EmitDefaultValue = false)] + public long PetId { get; set; } + + /// + /// Gets or Sets Quantity + /// + [DataMember(Name = "quantity", EmitDefaultValue = false)] + public int Quantity { get; set; } + + /// + /// Gets or Sets ShipDate + /// + [DataMember(Name = "shipDate", EmitDefaultValue = false)] + public DateTime ShipDate { get; set; } + + /// + /// Gets or Sets Complete + /// + [DataMember(Name = "complete", EmitDefaultValue = false)] + public bool Complete { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Order {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" PetId: ").Append(PetId).Append("\n"); + sb.Append(" Quantity: ").Append(Quantity).Append("\n"); + sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Complete: ").Append(Complete).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as Order).AreEqual; + } + + /// + /// Returns true if Order instances are equal + /// + /// Instance of Order to be compared + /// Boolean + public bool Equals(Order input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = hashCode * 59 + this.Id.GetHashCode(); + hashCode = hashCode * 59 + this.PetId.GetHashCode(); + hashCode = hashCode * 59 + this.Quantity.GetHashCode(); + if (this.ShipDate != null) + hashCode = hashCode * 59 + this.ShipDate.GetHashCode(); + hashCode = hashCode * 59 + this.Status.GetHashCode(); + hashCode = hashCode * 59 + this.Complete.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Pet.cs new file mode 100644 index 00000000000..f1f98667f36 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Pet.cs @@ -0,0 +1,218 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// A pet for sale in the pet store + /// + [DataContract(Name = "Pet")] + public partial class Pet : IEquatable, IValidatableObject + { + /// + /// pet status in the store + /// + /// pet status in the store + [JsonConverter(typeof(StringEnumConverter))] + public enum StatusEnum + { + /// + /// Enum Available for value: available + /// + [EnumMember(Value = "available")] + Available = 1, + + /// + /// Enum Pending for value: pending + /// + [EnumMember(Value = "pending")] + Pending = 2, + + /// + /// Enum Sold for value: sold + /// + [EnumMember(Value = "sold")] + Sold = 3 + + } + + /// + /// pet status in the store + /// + /// pet status in the store + [DataMember(Name = "status", EmitDefaultValue = false)] + public StatusEnum? Status { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Pet() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// id. + /// category. + /// name (required). + /// photoUrls (required). + /// tags. + /// pet status in the store. + public Pet(long id = default(long), Category category = default(Category), string name = default(string), List photoUrls = default(List), List tags = default(List), StatusEnum? status = default(StatusEnum?)) + { + // to ensure "name" is required (not null) + this.Name = name ?? throw new ArgumentNullException("name is a required property for Pet and cannot be null"); + // to ensure "photoUrls" is required (not null) + this.PhotoUrls = photoUrls ?? throw new ArgumentNullException("photoUrls is a required property for Pet and cannot be null"); + this.Id = id; + this.Category = category; + this.Tags = tags; + this.Status = status; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", EmitDefaultValue = false)] + public long Id { get; set; } + + /// + /// Gets or Sets Category + /// + [DataMember(Name = "category", EmitDefaultValue = false)] + public Category Category { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = false)] + public string Name { get; set; } + + /// + /// Gets or Sets PhotoUrls + /// + [DataMember(Name = "photoUrls", IsRequired = true, EmitDefaultValue = false)] + public List PhotoUrls { get; set; } + + /// + /// Gets or Sets Tags + /// + [DataMember(Name = "tags", EmitDefaultValue = false)] + public List Tags { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Pet {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Tags: ").Append(Tags).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as Pet).AreEqual; + } + + /// + /// Returns true if Pet instances are equal + /// + /// Instance of Pet to be compared + /// Boolean + public bool Equals(Pet input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = hashCode * 59 + this.Id.GetHashCode(); + if (this.Category != null) + hashCode = hashCode * 59 + this.Category.GetHashCode(); + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.GetHashCode(); + if (this.PhotoUrls != null) + hashCode = hashCode * 59 + this.PhotoUrls.GetHashCode(); + if (this.Tags != null) + hashCode = hashCode * 59 + this.Tags.GetHashCode(); + hashCode = hashCode * 59 + this.Status.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Tag.cs new file mode 100644 index 00000000000..1142ff9557e --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Tag.cs @@ -0,0 +1,138 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// A tag for a pet + /// + [DataContract(Name = "Tag")] + public partial class Tag : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id. + /// name. + public Tag(long id = default(long), string name = default(string)) + { + this.Id = id; + this.Name = name; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", EmitDefaultValue = false)] + public long Id { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", EmitDefaultValue = false)] + public string Name { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Tag {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as Tag).AreEqual; + } + + /// + /// Returns true if Tag instances are equal + /// + /// Instance of Tag to be compared + /// Boolean + public bool Equals(Tag input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = hashCode * 59 + this.Id.GetHashCode(); + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/User.cs new file mode 100644 index 00000000000..94910923572 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/User.cs @@ -0,0 +1,204 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// A User who is purchasing from the pet store + /// + [DataContract(Name = "User")] + public partial class User : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id. + /// username. + /// firstName. + /// lastName. + /// email. + /// password. + /// phone. + /// User Status. + public User(long id = default(long), string username = default(string), string firstName = default(string), string lastName = default(string), string email = default(string), string password = default(string), string phone = default(string), int userStatus = default(int)) + { + this.Id = id; + this.Username = username; + this.FirstName = firstName; + this.LastName = lastName; + this.Email = email; + this.Password = password; + this.Phone = phone; + this.UserStatus = userStatus; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", EmitDefaultValue = false)] + public long Id { get; set; } + + /// + /// Gets or Sets Username + /// + [DataMember(Name = "username", EmitDefaultValue = false)] + public string Username { get; set; } + + /// + /// Gets or Sets FirstName + /// + [DataMember(Name = "firstName", EmitDefaultValue = false)] + public string FirstName { get; set; } + + /// + /// Gets or Sets LastName + /// + [DataMember(Name = "lastName", EmitDefaultValue = false)] + public string LastName { get; set; } + + /// + /// Gets or Sets Email + /// + [DataMember(Name = "email", EmitDefaultValue = false)] + public string Email { get; set; } + + /// + /// Gets or Sets Password + /// + [DataMember(Name = "password", EmitDefaultValue = false)] + public string Password { get; set; } + + /// + /// Gets or Sets Phone + /// + [DataMember(Name = "phone", EmitDefaultValue = false)] + public string Phone { get; set; } + + /// + /// User Status + /// + /// User Status + [DataMember(Name = "userStatus", EmitDefaultValue = false)] + public int UserStatus { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class User {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Phone: ").Append(Phone).Append("\n"); + sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as User).AreEqual; + } + + /// + /// Returns true if User instances are equal + /// + /// Instance of User to be compared + /// Boolean + public bool Equals(User input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = hashCode * 59 + this.Id.GetHashCode(); + if (this.Username != null) + hashCode = hashCode * 59 + this.Username.GetHashCode(); + if (this.FirstName != null) + hashCode = hashCode * 59 + this.FirstName.GetHashCode(); + if (this.LastName != null) + hashCode = hashCode * 59 + this.LastName.GetHashCode(); + if (this.Email != null) + hashCode = hashCode * 59 + this.Email.GetHashCode(); + if (this.Password != null) + hashCode = hashCode * 59 + this.Password.GetHashCode(); + if (this.Phone != null) + hashCode = hashCode * 59 + this.Phone.GetHashCode(); + hashCode = hashCode * 59 + this.UserStatus.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 00000000000..2afcc21e123 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,31 @@ + + + + false + net5.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + + + + + + + + + + + + From 5de112fca512436f36c1f34446c63bff61e54c55 Mon Sep 17 00:00:00 2001 From: Nicolas Bouvrette Date: Tue, 19 Jan 2021 14:24:13 -0500 Subject: [PATCH 08/54] Update roadmap.md (#8473) Fixing broken link. --- docs/roadmap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/roadmap.md b/docs/roadmap.md index c56e7dbe641..8dc6e85c3e3 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -59,7 +59,7 @@ Short term are focused on improving contributor and user productivity (part of t * SPI plugins * Templating engine * Language extensions - * Custom extensions (e.g. allowing users to load support for https://github.com/Azure/azure-rest-api-specs[azure-rest-api-specs]) + * Custom extensions (e.g. allowing users to load support for [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs)) * Customizable templating engines (handlebars support) * Unit-testing templates (to previously mentioned explicit type as an interface to the template) * Reduce coupling From 4d75a29991a343ad63fb5a0c9832f149f9b854e3 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 20 Jan 2021 18:51:56 +0800 Subject: [PATCH 09/54] fix typo in useOneOfDiscriminatorLookup (#8480) --- docs/generators/csharp-netcore.md | 2 +- docs/generators/go.md | 2 +- docs/generators/powershell.md | 2 +- .../main/java/org/openapitools/codegen/CodegenConstants.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/generators/csharp-netcore.md b/docs/generators/csharp-netcore.md index d2d2240d94c..60a347dfea5 100644 --- a/docs/generators/csharp-netcore.md +++ b/docs/generators/csharp-netcore.md @@ -31,7 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |targetFramework|The target .NET framework version.|
**netstandard1.3**
.NET Standard 1.3 compatible
**netstandard1.4**
.NET Standard 1.4 compatible
**netstandard1.5**
.NET Standard 1.5 compatible
**netstandard1.6**
.NET Standard 1.6 compatible
**netstandard2.0**
.NET Standard 2.0 compatible
**netstandard2.1**
.NET Standard 2.1 compatible
**netcoreapp2.0**
.NET Core 2.0 compatible
**netcoreapp2.1**
.NET Core 2.1 compatible
**netcoreapp3.0**
.NET Core 3.0 compatible
**netcoreapp3.1**
.NET Core 3.1 compatible
**net47**
.NET Framework 4.7 compatible
**net5.0**
.NET 5.0 compatible
|netstandard2.0| |useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false| |useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false| -|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and onlye one match in oneOf's schemas) will be skipped.| |false| +|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |false| |validatable|Generates self-validatable models.| |true| ## IMPORT MAPPING diff --git a/docs/generators/go.md b/docs/generators/go.md index 6399eb4a3e7..a2318c003f3 100644 --- a/docs/generators/go.md +++ b/docs/generators/go.md @@ -16,7 +16,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |packageVersion|Go package version.| |1.0.0| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |structPrefix|whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts| |false| -|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and onlye one match in oneOf's schemas) will be skipped.| |false| +|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |false| |withAWSV4Signature|whether to include AWS v4 signature support| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| diff --git a/docs/generators/powershell.md b/docs/generators/powershell.md index 19ee0fe1218..a9c14eab47d 100644 --- a/docs/generators/powershell.md +++ b/docs/generators/powershell.md @@ -21,7 +21,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |releaseNotes|Release notes of the generated PowerShell module| |null| |skipVerbParsing|Set skipVerbParsing to not try get powershell verbs of operation names| |null| |tags|Tags applied to the generated PowerShell module. These help with module discovery in online galleries| |null| -|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and onlye one match in oneOf's schemas) will be skipped.| |null| +|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |null| ## IMPORT MAPPING diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index b66b232129f..d576eea2c40 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -367,5 +367,5 @@ public class CodegenConstants { "If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. " + "If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default."; public static final String USE_ONEOF_DISCRIMINATOR_LOOKUP = "useOneOfDiscriminatorLookup"; - public static final String USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC = "Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and onlye one match in oneOf's schemas) will be skipped."; + public static final String USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC = "Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped."; } From a61b7bbc6564bb1526f4254c4cd54e3cc8cd7eda Mon Sep 17 00:00:00 2001 From: Richard Whitehouse Date: Wed, 20 Jan 2021 23:16:54 +0000 Subject: [PATCH 10/54] [Rust Server] Reinstate tests (#8477) * Revert "comment out rust server tests (#8440)" This reverts commit 32b01cb39bea5bc0d006e9d31d41afedf4dcab29. * Update to swagger-rs 5.0.2 * Update samples for swagger-rs 5.0.2 * Update swagger multipart usage - swagger/multipart renamed multipart_form - Update boundary call * Update samples --- .../src/main/resources/rust-server/Cargo.mustache | 4 ++-- .../src/main/resources/rust-server/server-operation.mustache | 2 +- pom.xml | 2 +- .../petstore/rust-server/output/multipart-v3/Cargo.toml | 4 ++-- .../rust-server/output/multipart-v3/src/server/mod.rs | 2 +- .../petstore/rust-server/output/no-example-v3/Cargo.toml | 2 +- .../server/petstore/rust-server/output/openapi-v3/Cargo.toml | 2 +- samples/server/petstore/rust-server/output/ops-v3/Cargo.toml | 2 +- .../Cargo.toml | 4 ++-- .../src/server/mod.rs | 2 +- .../petstore/rust-server/output/rust-server-test/Cargo.toml | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache index 6625d274b0a..4c733fbafe4 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache @@ -15,7 +15,7 @@ client = [ "mime_0_2", {{/apiUsesMultipart}} {{#apiUsesMultipartFormData}} - "multipart", "multipart/client", "swagger/multipart", + "multipart", "multipart/client", "swagger/multipart_form", {{/apiUsesMultipartFormData}} {{#apiUsesMultipartRelated}} "hyper_0_10", "mime_multipart", @@ -60,7 +60,7 @@ openssl = {version = "0.10", optional = true } async-trait = "0.1.24" chrono = { version = "0.4", features = ["serde"] } futures = "0.3" -swagger = "5.0.0-alpha-1" +swagger = "5.0.2" log = "0.4.0" mime = "0.3" diff --git a/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache b/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache index 6399da844aa..cbb812e4f26 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache @@ -39,7 +39,7 @@ {{/hasAuthMethods}} {{#vendorExtensions}} {{#x-consumes-multipart}} - let boundary = match swagger::multipart::boundary(&headers) { + let boundary = match swagger::multipart::form::boundary(&headers) { Some(boundary) => boundary.to_string(), None => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) diff --git a/pom.xml b/pom.xml index 79d7cf93da1..1213adf3b32 100644 --- a/pom.xml +++ b/pom.xml @@ -1189,7 +1189,7 @@ samples/server/petstore/php-slim4 samples/server/petstore/php-laravel samples/server/petstore/php-lumen - + samples/server/petstore/rust-server diff --git a/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml b/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml index eaca5af92e2..9efa57da146 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" default = ["client", "server"] client = [ "mime_0_2", - "multipart", "multipart/client", "swagger/multipart", + "multipart", "multipart/client", "swagger/multipart_form", "hyper_0_10", "mime_multipart", "hyper", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] @@ -35,7 +35,7 @@ openssl = {version = "0.10", optional = true } async-trait = "0.1.24" chrono = { version = "0.4", features = ["serde"] } futures = "0.3" -swagger = "5.0.0-alpha-1" +swagger = "5.0.2" log = "0.4.0" mime = "0.3" diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs index 72cf6b4f20e..a9890bb121a 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs @@ -286,7 +286,7 @@ impl hyper::service::Service<(Request, C)> for Service where // MultipartRequestPost - POST /multipart_request &hyper::Method::POST if path.matched(paths::ID_MULTIPART_REQUEST) => { - let boundary = match swagger::multipart::boundary(&headers) { + let boundary = match swagger::multipart::form::boundary(&headers) { Some(boundary) => boundary.to_string(), None => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) diff --git a/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml b/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml index da632fac28d..589b163d0e3 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/no-example-v3/Cargo.toml @@ -29,7 +29,7 @@ openssl = {version = "0.10", optional = true } async-trait = "0.1.24" chrono = { version = "0.4", features = ["serde"] } futures = "0.3" -swagger = "5.0.0-alpha-1" +swagger = "5.0.2" log = "0.4.0" mime = "0.3" diff --git a/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml b/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml index 0f19d1f064a..45c2007cd6f 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml @@ -31,7 +31,7 @@ openssl = {version = "0.10", optional = true } async-trait = "0.1.24" chrono = { version = "0.4", features = ["serde"] } futures = "0.3" -swagger = "5.0.0-alpha-1" +swagger = "5.0.2" log = "0.4.0" mime = "0.3" diff --git a/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml b/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml index 793ffbb6c00..5410fb3d3cf 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml @@ -29,7 +29,7 @@ openssl = {version = "0.10", optional = true } async-trait = "0.1.24" chrono = { version = "0.4", features = ["serde"] } futures = "0.3" -swagger = "5.0.0-alpha-1" +swagger = "5.0.2" log = "0.4.0" mime = "0.3" diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml index 869f0b722d7..fb344637445 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" default = ["client", "server"] client = [ "mime_0_2", - "multipart", "multipart/client", "swagger/multipart", + "multipart", "multipart/client", "swagger/multipart_form", "serde_urlencoded", "hyper", "hyper-openssl", "hyper-tls", "native-tls", "openssl", "url" ] @@ -34,7 +34,7 @@ openssl = {version = "0.10", optional = true } async-trait = "0.1.24" chrono = { version = "0.4", features = ["serde"] } futures = "0.3" -swagger = "5.0.0-alpha-1" +swagger = "5.0.2" log = "0.4.0" mime = "0.3" diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs index a4ea1843810..9803b110d86 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs @@ -1989,7 +1989,7 @@ impl hyper::service::Service<(Request, C)> for Service where } } - let boundary = match swagger::multipart::boundary(&headers) { + let boundary = match swagger::multipart::form::boundary(&headers) { Some(boundary) => boundary.to_string(), None => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) diff --git a/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml b/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml index adb71498607..929cb2bf04b 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml +++ b/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml @@ -29,7 +29,7 @@ openssl = {version = "0.10", optional = true } async-trait = "0.1.24" chrono = { version = "0.4", features = ["serde"] } futures = "0.3" -swagger = "5.0.0-alpha-1" +swagger = "5.0.2" log = "0.4.0" mime = "0.3" From 1ceb5f5c9669428342c5f636a7da46ee94825549 Mon Sep 17 00:00:00 2001 From: Karsten Thoms Date: Thu, 21 Jan 2021 02:48:25 +0100 Subject: [PATCH 11/54] Update README.adoc (#8488) --- modules/openapi-generator-gradle-plugin/README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc index a9f1c58ab18..5590516dc1d 100644 --- a/modules/openapi-generator-gradle-plugin/README.adoc +++ b/modules/openapi-generator-gradle-plugin/README.adoc @@ -551,7 +551,7 @@ BUILD SUCCESSFUL in 0s === openApiValidate -.in buid.gradle +.in build.gradle [source,groovy] ---- openApiValidate { From b447e4f51dea35bb92768b99abd673b5597eab32 Mon Sep 17 00:00:00 2001 From: Jose Tom Date: Thu, 21 Jan 2021 13:17:49 +0530 Subject: [PATCH 12/54] [ plugin docs ] Update gradle plugin version to 5.0.0 (#8490) * Update gradle plugin version to 4.3.1 1. Updated gradle plugin version to 4.3.1 (to keep in sync with maven sample) 2. Removed modelFilesConstrainedTo in the gradle sample to generate code for dummies who are pasting and running. * Update version to 5.0.0 --- docs/plugins.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/plugins.md b/docs/plugins.md index 7fcbf4ac4c1..224a0d5fa58 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -15,7 +15,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase) org.openapitools openapi-generator-maven-plugin - 4.3.1 + 5.0.0 @@ -76,7 +76,7 @@ buildscript { maven { url "https://repo1.maven.org/maven2" } } dependencies { - classpath "org.openapitools:openapi-generator-gradle-plugin:3.3.4" + classpath "org.openapitools:openapi-generator-gradle-plugin:5.0.0" } } @@ -111,9 +111,6 @@ openApiGenerate { apiPackage = "org.openapi.example.api" invokerPackage = "org.openapi.example.invoker" modelPackage = "org.openapi.example.model" - modelFilesConstrainedTo = [ - "Error" - ] configOptions = [ dateLibrary: "java8" ] From 3d23b99242ad80f440d4ca3eb9f90103a4ec208b Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 21 Jan 2021 21:21:40 +0800 Subject: [PATCH 13/54] minor fix to powershell api doc (#8496) --- .../languages/PowerShellClientCodegen.java | 16 +++++- .../resources/powershell/api_doc.mustache | 19 +++---- .../petstore/powershell/docs/PSPetApi.md | 56 +++++++++---------- .../petstore/powershell/docs/PSStoreApi.md | 10 ++-- .../petstore/powershell/docs/PSUserApi.md | 52 ++++++++--------- 5 files changed, 81 insertions(+), 72 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java index d2b4a8d1ed2..ccfcf6d55e7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java @@ -1082,7 +1082,12 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo if (StringUtils.isEmpty(codegenParameter.example)) { return "\"" + codegenParameter.example + "\""; } else { - return "\"" + codegenParameter.paramName + "_example\""; + if (Boolean.TRUE.equals(codegenParameter.isEnum)) { // enum + List enumValues = (List) codegenParameter.allowableValues.get("values"); + return "\"" + String.valueOf(enumValues.get(0)) + "\""; + } else { + return "\"" + codegenParameter.paramName + "_example\""; + } } } else if ("Boolean".equals(codegenParameter.dataType) || "System.Nullable[Boolean]".equals(codegenParameter.dataType)) { // boolean @@ -1124,7 +1129,12 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo if (StringUtils.isEmpty(codegenProperty.example)) { return "\"" + codegenProperty.example + "\""; } else { - return "\"" + codegenProperty.name + "_example\""; + if (Boolean.TRUE.equals(codegenProperty.isEnum)) { // enum + List enumValues = (List) codegenProperty.allowableValues.get("values"); + return "\"" + String.valueOf(enumValues.get(0)) + "\""; + } else { + return "\"" + codegenProperty.name + "_example\""; + } } } else if ("Boolean".equals(codegenProperty.dataType) || "System.Nullable[Boolean]".equals(codegenProperty.dataType)) { // boolean @@ -1173,7 +1183,7 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo processedModelMap.put(model, 1); } - example = "(Initialize-" + codegenModel.name; + example = "(Initialize-" + codegenModel.name + " "; List propertyExamples = new ArrayList<>(); for (CodegenProperty codegenProperty : codegenModel.allVars) { propertyExamples.add("-" + codegenProperty.name + " " + constructExampleCode(codegenProperty, modelMaps, processedModelMap)); diff --git a/modules/openapi-generator/src/main/resources/powershell/api_doc.mustache b/modules/openapi-generator/src/main/resources/powershell/api_doc.mustache index e12e7e2b749..14f96341ead 100644 --- a/modules/openapi-generator/src/main/resources/powershell/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/api_doc.mustache @@ -26,24 +26,24 @@ Method | HTTP request | Description Import-Module -Name {{{packageName}}} {{#hasAuthMethods}} -$Configuration = Get-{{{packageName}}}Configuration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration {{#authMethods}} {{#isBasic}} # Configure HTTP basic authorization: {{{name}}} -$Configuration["Username"] = "YOUR_USERNAME"; -$Configuration["Password"] = "YOUR_PASSWORD"; +$Configuration.Username = "YOUR_USERNAME" +$Configuration.Password = "YOUR_PASSWORD" {{/isBasic}} {{#isApiKey}} # Configure API key authorization: {{{name}}} -$Configuration["ApiKey"]["{{{keyParamName}}}"] = "YOUR_API_KEY" +$Configuration.ApiKey.{{{keyParamName}}} = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration["ApiKeyPrefix"]["{{{keyParamName}}}"] = "Bearer" +#$Configuration.ApiKeyPrefix.{{{keyParamName}}} = "Bearer" {{/isApiKey}} {{#isOAuth}} # Configure OAuth2 access token for authorization: {{{name}}} -$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" {{/isOAuth}} - {{#isHttpSignature}} # Configure HttpSignature for authorization :{{name}} $httpSigningParams = @{ @@ -52,11 +52,10 @@ $httpSigningParams = @{ HttpSigningHeader = @("(request-target)","Host","Date","Digest") HashAlgorithm = "sha256" } -Set-{{{packageName}}}ConfigurationHttpSigning @httpSigningParams - +Set-ConfigurationHttpSigning $httpSigningParams {{/isHttpSignature}} -{{/authMethods}} +{{/authMethods}} {{/hasAuthMethods}} {{#allParams}} ${{paramName}} = {{{vendorExtensions.x-powershell-example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} diff --git a/samples/client/petstore/powershell/docs/PSPetApi.md b/samples/client/petstore/powershell/docs/PSPetApi.md index fef72996026..862d4898be7 100644 --- a/samples/client/petstore/powershell/docs/PSPetApi.md +++ b/samples/client/petstore/powershell/docs/PSPetApi.md @@ -25,12 +25,12 @@ Add a new pet to the store ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth -$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" - -$Pet = (Initialize-Pet-Id 123 -Category (Initialize-Category-Id 123 -Name "Name_example") -Name "Name_example" -PhotoUrls @("PhotoUrls_example") -Tags @((Initialize-Tag-Id 123 -Name "Name_example")) -Status "Status_example") # Pet | Pet object that needs to be added to the store +$Pet = (Initialize-Pet -Id 123 -Category (Initialize-Category -Id 123 -Name "Name_example") -Name "Name_example" -PhotoUrls @("PhotoUrls_example") -Tags @((Initialize-Tag -Id 123 -Name "Name_example")) -Status "available") # Pet | Pet object that needs to be added to the store # Add a new pet to the store try { @@ -74,10 +74,10 @@ Deletes a pet ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth -$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; - +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" $PetId = 987 # Int64 | Pet id to delete $ApiKey = "ApiKey_example" # String | (optional) @@ -126,12 +126,12 @@ Multiple status values can be provided with comma separated strings ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth -$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" - -$Status = @("Status_example") # String[] | Status values that need to be considered for filter +$Status = @("available") # String[] | Status values that need to be considered for filter # Finds Pets by status try { @@ -176,10 +176,10 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth -$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; - +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" $Tags = @("Inner_example") # String[] | Tags to filter by @@ -226,12 +226,12 @@ Returns a single pet ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure API key authorization: api_key -$Configuration["ApiKey"]["api_key"] = "YOUR_API_KEY" +$Configuration.ApiKey.api_key = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration["ApiKeyPrefix"]["api_key"] = "Bearer" - +#$Configuration.ApiKeyPrefix.api_key = "Bearer" $PetId = 987 # Int64 | ID of pet to return @@ -276,12 +276,12 @@ Update an existing pet ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth -$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" - -$Pet = (Initialize-Pet-Id 123 -Category (Initialize-Category-Id 123 -Name "Name_example") -Name "Name_example" -PhotoUrls @("PhotoUrls_example") -Tags @((Initialize-Tag-Id 123 -Name "Name_example")) -Status "Status_example") # Pet | Pet object that needs to be added to the store +$Pet = (Initialize-Pet -Id 123 -Category (Initialize-Category -Id 123 -Name "Name_example") -Name "Name_example" -PhotoUrls @("PhotoUrls_example") -Tags @((Initialize-Tag -Id 123 -Name "Name_example")) -Status "available") # Pet | Pet object that needs to be added to the store # Update an existing pet try { @@ -326,10 +326,10 @@ Updates a pet in the store with form data ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth -$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; - +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" $PetId = 987 # Int64 | ID of pet that needs to be updated $Name = "Name_example" # String | Updated name of the pet (optional) @@ -380,10 +380,10 @@ uploads an image ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth -$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN"; - +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" $PetId = 987 # Int64 | ID of pet to update $AdditionalMetadata = "AdditionalMetadata_example" # String | Additional data to pass to server (optional) diff --git a/samples/client/petstore/powershell/docs/PSStoreApi.md b/samples/client/petstore/powershell/docs/PSStoreApi.md index c411c2f854f..f12946fb546 100644 --- a/samples/client/petstore/powershell/docs/PSStoreApi.md +++ b/samples/client/petstore/powershell/docs/PSStoreApi.md @@ -67,12 +67,12 @@ Returns a map of status codes to quantities ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure API key authorization: api_key -$Configuration["ApiKey"]["api_key"] = "YOUR_API_KEY" +$Configuration.ApiKey.api_key = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration["ApiKeyPrefix"]["api_key"] = "Bearer" - +#$Configuration.ApiKeyPrefix.api_key = "Bearer" # Returns pet inventories by status @@ -158,7 +158,7 @@ Place an order for a pet ```powershell Import-Module -Name PSPetstore -$Order = (Initialize-Order-Id 123 -PetId 123 -Quantity 123 -ShipDate Get-Date -Status "Status_example" -Complete $false) # Order | order placed for purchasing the pet +$Order = (Initialize-Order -Id 123 -PetId 123 -Quantity 123 -ShipDate Get-Date -Status "placed" -Complete $false) # Order | order placed for purchasing the pet # Place an order for a pet try { diff --git a/samples/client/petstore/powershell/docs/PSUserApi.md b/samples/client/petstore/powershell/docs/PSUserApi.md index f6ed241c88b..1548935037c 100644 --- a/samples/client/petstore/powershell/docs/PSUserApi.md +++ b/samples/client/petstore/powershell/docs/PSUserApi.md @@ -27,14 +27,14 @@ This can only be done by the logged in user. ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure API key authorization: auth_cookie -$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" +$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer" +#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" - -$User = (Initialize-User-Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123) # User | Created user object +$User = (Initialize-User -Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123) # User | Created user object # Create user try { @@ -77,14 +77,14 @@ Creates list of users with given input array ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure API key authorization: auth_cookie -$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" +$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer" +#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" - -$User = @((Initialize-User-Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123)) # User[] | List of user object +$User = @((Initialize-User -Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123)) # User[] | List of user object # Creates list of users with given input array try { @@ -127,12 +127,12 @@ Creates list of users with given input array ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure API key authorization: auth_cookie -$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" +$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer" - +#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" $User = @() # User[] | List of user object @@ -179,12 +179,12 @@ This can only be done by the logged in user. ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure API key authorization: auth_cookie -$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" +$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer" - +#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" $Username = "Username_example" # String | The name that needs to be deleted @@ -317,12 +317,12 @@ Logs out current logged in user session ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure API key authorization: auth_cookie -$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" +$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer" - +#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" # Logs out current logged in user session @@ -366,12 +366,12 @@ This can only be done by the logged in user. ```powershell Import-Module -Name PSPetstore -$Configuration = Get-PSPetstoreConfiguration +# general setting of the PowerShell module, e.g. base URL, authentication, etc +$Configuration = Get-Configuration # Configure API key authorization: auth_cookie -$Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY" +$Configuration.ApiKey.AUTH_KEY = "YOUR_API_KEY" # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer" - +#$Configuration.ApiKeyPrefix.AUTH_KEY = "Bearer" $Username = "Username_example" # String | name that need to be deleted $User = # User | Updated user object From 2331432cc0f062ceff44c3d09e1a16c31abf6f57 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 21 Jan 2021 09:52:49 -0800 Subject: [PATCH 14/54] Adds hasValidation to all java core Schema classes (#8474) * Adds hasValidation to IJsonSchemaValidationProperties * Adds model validation examples for maxItems, minItems, minProperties, maxProperties, minLength, maxLength, multipleOf * Adds schemas with pattern validation * Adds minimum example schemas * Adds maximum example schemas * Adds ArrayWithUniqueItems * Adds exclusiveMinimum schemas * Adds exclusiveMaximum examples * adds testModelGetHasValidation * Adds testPropertyGetHasValidation * Adds testQueryParametersGetHasValidation * Uncomments out query parameters * Adds testHeaderParametersGetHasValidation * Adds testCookieParametersGetHasValidation * Adds length assertions for properties and marameters * Adds testBodyAndResponseGetHasValidation * Improves validation setting * Only sets exclusiveMinimum when minimum is set, only set exclusiveMaximum when maximum is set * Adds fix for rust * Fixes min and max setting for integers * Regenerates python samples * Updates code so python sample does not change --- .../openapitools/codegen/CodegenModel.java | 17 +- .../codegen/CodegenParameter.java | 6 + .../openapitools/codegen/CodegenProperty.java | 6 + .../openapitools/codegen/CodegenResponse.java | 11 +- .../openapitools/codegen/DefaultCodegen.java | 133 +- .../IJsonSchemaValidationProperties.java | 4 + .../codegen/utils/ModelUtils.java | 91 +- .../codegen/DefaultCodegenTest.java | 221 ++ .../src/test/resources/3_0/issue_7651.yaml | 2733 ++++++++++++++++- 9 files changed, 3072 insertions(+), 150 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java index 4bcb5dd4bf9..1663343387f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java @@ -79,7 +79,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties { public Set allMandatory = new TreeSet(); // with parent's required properties public Set imports = new TreeSet(); - public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum; + public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasValidation; /** * Indicates the OAS schema specifies "nullable: true". */ @@ -612,12 +612,11 @@ public class CodegenModel implements IJsonSchemaValidationProperties { this.additionalProperties = additionalProperties; } - // indicates if the model component has validation on the root level schema - // this will be true when minItems or minProperties is set - public boolean hasValidation() { - boolean val = (maxItems != null || minItems != null || minProperties != null || maxProperties != null || minLength != null || maxLength != null || multipleOf != null || pattern != null || minimum != null || maximum != null || Boolean.TRUE.equals(uniqueItems) || Boolean.TRUE.equals(exclusiveMaximum) || Boolean.TRUE.equals(exclusiveMinimum)); - return val; - } + @Override + public boolean getHasValidation() { return hasValidation; } + + @Override + public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; } public List getReadOnlyVars() { return readOnlyVars; @@ -742,6 +741,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties { isDeprecated == that.isDeprecated && hasOnlyReadOnly == that.hasOnlyReadOnly && isNull == that.isNull && + hasValidation == that.hasValidation && getUniqueItems() == that.getUniqueItems() && getExclusiveMinimum() == that.getExclusiveMinimum() && getExclusiveMaximum() == that.getExclusiveMaximum() && @@ -806,7 +806,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties { getDescription(), getClassVarName(), getModelJson(), getDataType(), getXmlPrefix(), getXmlNamespace(), getXmlName(), getClassFilename(), getUnescapedDescription(), getDiscriminator(), getDefaultValue(), getArrayModelType(), isAlias, isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, - isDate, isDateTime, isNull, + isDate, isDateTime, isNull, hasValidation, getVars(), getAllVars(), getRequiredVars(), getOptionalVars(), getReadOnlyVars(), getReadWriteVars(), getParentVars(), getAllowableValues(), getMandatory(), getAllMandatory(), getImports(), hasVars, isEmptyVars(), hasMoreModels, hasEnums, isEnum, isNullable, hasRequired, hasOptional, isArray, @@ -898,6 +898,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties { sb.append(", additionalProperties='").append(additionalProperties).append('\''); sb.append(", isModel='").append(isModel).append('\''); sb.append(", isNull='").append(isNull); + sb.append(", hasValidation='").append(hasValidation); sb.append('}'); return sb.toString(); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java index 7c6f80ae843..811d48d324c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java @@ -582,5 +582,11 @@ public class CodegenParameter implements IJsonSchemaValidationProperties { public void setIsNull(boolean isNull) { this.isNull = isNull; } + + @Override + public boolean getHasValidation() { return hasValidation; } + + @Override + public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java index b956a3ea7e1..60d32f47712 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java @@ -687,6 +687,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti this.isNull = isNull; } + @Override + public boolean getHasValidation() { return hasValidation; } + + @Override + public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; } + @Override public String toString() { final StringBuilder sb = new StringBuilder("CodegenProperty{"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java index 7762676b7ca..5db6b721715 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java @@ -78,6 +78,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { public CodegenProperty additionalProperties; public List vars = new ArrayList(); // all properties (without parent's properties) public List requiredVars = new ArrayList(); + private boolean hasValidation; @Override public int hashCode() { @@ -85,7 +86,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBoolean, isDate, isDateTime, isUuid, isEmail, isModel, isFreeFormObject, isAnyType, isDefault, simpleType, primitiveType, isMap, isArray, isBinary, isFile, schema, jsonSchema, vendorExtensions, items, additionalProperties, - vars, requiredVars, isNull, + vars, requiredVars, isNull, hasValidation, getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(), getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(), is1xx, is2xx, is3xx, is4xx, is5xx); @@ -124,6 +125,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { items == that.items && additionalProperties == that.additionalProperties && isNull == that.isNull && + hasValidation == that.hasValidation && is1xx == that.is1xx && is2xx == that.is2xx && is3xx == that.is3xx && @@ -426,6 +428,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { sb.append(", vars='").append(vars).append('\''); sb.append(", requiredVars='").append(requiredVars).append('\''); sb.append(", isNull='").append(isNull); + sb.append(", hasValidation='").append(hasValidation); sb.append('}'); return sb.toString(); } @@ -456,4 +459,10 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { public void setIsNull(boolean isNull) { this.isNull = isNull; } + + @Override + public boolean getHasValidation() { return hasValidation; } + + @Override + public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; } } 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 9f063bef496..e808a2bc1f7 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 @@ -2258,6 +2258,7 @@ public class DefaultCodegen implements CodegenConfig { } CodegenModel m = CodegenModelFactory.newInstance(CodegenModelType.MODEL); + ModelUtils.syncValidationProperties(schema, m); if (reservedWords.contains(name)) { m.name = escapeReservedWord(name); @@ -2305,7 +2306,6 @@ public class DefaultCodegen implements CodegenConfig { m.setItems(arrayProperty.items); m.arrayModelType = arrayProperty.complexType; addParentContainer(m, name, schema); - ModelUtils.syncValidationProperties(schema, m); } else if (ModelUtils.isNullType(schema)) { m.isNull = true; } else if (schema instanceof ComposedSchema) { @@ -2500,8 +2500,6 @@ public class DefaultCodegen implements CodegenConfig { m.isMap = true; } else if (ModelUtils.isIntegerSchema(schema)) { // integer type // NOTE: Integral schemas as CodegenModel is a rare use case and may be removed at a later date. - // Sync of properties is done for consistency with other data types like CodegenParameter/CodegenProperty. - ModelUtils.syncValidationProperties(schema, m); m.isNumeric = Boolean.TRUE; if (ModelUtils.isLongSchema(schema)) { // int64/long format @@ -2511,23 +2509,15 @@ public class DefaultCodegen implements CodegenConfig { } } else if (ModelUtils.isDateTimeSchema(schema)) { // NOTE: DateTime schemas as CodegenModel is a rare use case and may be removed at a later date. - // Sync of properties is done for consistency with other data types like CodegenParameter/CodegenProperty. - ModelUtils.syncValidationProperties(schema, m); m.isDateTime = Boolean.TRUE; } else if (ModelUtils.isDateSchema(schema)) { // NOTE: Date schemas as CodegenModel is a rare use case and may be removed at a later date. - // Sync of properties is done for consistency with other data types like CodegenParameter/CodegenProperty. - ModelUtils.syncValidationProperties(schema, m); m.isDate = Boolean.TRUE; } else if (ModelUtils.isStringSchema(schema)) { // NOTE: String schemas as CodegenModel is a rare use case and may be removed at a later date. - // Sync of properties is done for consistency with other data types like CodegenParameter/CodegenProperty. - ModelUtils.syncValidationProperties(schema, m); m.isString = Boolean.TRUE; } else if (ModelUtils.isNumberSchema(schema)) { // NOTE: Number schemas as CodegenModel is a rare use case and may be removed at a later date. - // Sync of properties is done for consistency with other data types like CodegenParameter/CodegenProperty. - ModelUtils.syncValidationProperties(schema, m); m.isNumeric = Boolean.TRUE; if (ModelUtils.isFloatSchema(schema)) { // float m.isFloat = Boolean.TRUE; @@ -2538,7 +2528,6 @@ public class DefaultCodegen implements CodegenConfig { } } else if (ModelUtils.isFreeFormObject(openAPI, schema)) { addAdditionPropertiesToCodeGenModel(m, schema); - ModelUtils.syncValidationProperties(schema, m); } if (Boolean.TRUE.equals(schema.getNullable())) { @@ -3077,7 +3066,6 @@ public class DefaultCodegen implements CodegenConfig { p = unaliasSchema(p, importMapping); CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY); - ModelUtils.syncValidationProperties(p, property); property.name = toVarName(name); @@ -3144,27 +3132,6 @@ public class DefaultCodegen implements CodegenConfig { property.isInteger = Boolean.TRUE; } - if (p.getMinimum() != null) { - property.minimum = String.valueOf(p.getMinimum().longValue()); - } - if (p.getMaximum() != null) { - property.maximum = String.valueOf(p.getMaximum().longValue()); - } - if (p.getExclusiveMinimum() != null) { - property.exclusiveMinimum = p.getExclusiveMinimum(); - } - if (p.getExclusiveMaximum() != null) { - property.exclusiveMaximum = p.getExclusiveMaximum(); - } - if (p.getMultipleOf() != null) { - property.multipleOf = p.getMultipleOf(); - } - - // check if any validation rule defined - // exclusive* are noop without corresponding min/max - if (property.minimum != null || property.maximum != null || p.getMultipleOf() != null) - property.hasValidation = true; - } else if (ModelUtils.isBooleanSchema(p)) { // boolean type property.isBoolean = true; property.getter = toBooleanGetter(name); @@ -3177,27 +3144,6 @@ public class DefaultCodegen implements CodegenConfig { property.isDateTime = true; } else if (ModelUtils.isDecimalSchema(p)) { // type: string, format: number property.isDecimal = true; - if (p.getMinimum() != null) { - property.minimum = String.valueOf(p.getMinimum()); - } - if (p.getMaximum() != null) { - property.maximum = String.valueOf(p.getMaximum()); - } - if (p.getExclusiveMinimum() != null) { - property.exclusiveMinimum = p.getExclusiveMinimum(); - } - if (p.getExclusiveMaximum() != null) { - property.exclusiveMaximum = p.getExclusiveMaximum(); - } - if (p.getMultipleOf() != null) { - property.multipleOf = p.getMultipleOf(); - } - - // check if any validation rule defined - // exclusive* are noop without corresponding min/max - if (property.minimum != null || property.maximum != null || p.getMultipleOf() != null) { - property.hasValidation = true; - } } else if (ModelUtils.isStringSchema(p)) { if (ModelUtils.isByteArraySchema(p)) { property.isByteArray = true; @@ -3219,15 +3165,8 @@ public class DefaultCodegen implements CodegenConfig { } else { property.isString = true; } - - property.maxLength = p.getMaxLength(); - property.minLength = p.getMinLength(); property.pattern = toRegularExpression(p.getPattern()); - // check if any validation rule defined - if (property.pattern != null || property.minLength != null || property.maxLength != null) - property.hasValidation = true; - } else if (ModelUtils.isNumberSchema(p)) { property.isNumeric = Boolean.TRUE; if (ModelUtils.isFloatSchema(p)) { // float @@ -3238,28 +3177,6 @@ public class DefaultCodegen implements CodegenConfig { property.isNumber = Boolean.TRUE; } - if (p.getMinimum() != null) { - property.minimum = String.valueOf(p.getMinimum()); - } - if (p.getMaximum() != null) { - property.maximum = String.valueOf(p.getMaximum()); - } - if (p.getExclusiveMinimum() != null) { - property.exclusiveMinimum = p.getExclusiveMinimum(); - } - if (p.getExclusiveMaximum() != null) { - property.exclusiveMaximum = p.getExclusiveMaximum(); - } - if (p.getMultipleOf() != null) { - property.multipleOf = p.getMultipleOf(); - } - - // check if any validation rule defined - // exclusive* are noop without corresponding min/max - if (property.minimum != null || property.maximum != null || p.getMultipleOf() != null) { - property.hasValidation = true; - } - } else if (isFreeFormObject(p)) { property.isFreeFormObject = true; } else if (isAnyTypeSchema(p)) { @@ -3347,8 +3264,6 @@ public class DefaultCodegen implements CodegenConfig { } // handle inner property - property.maxItems = p.getMaxItems(); - property.minItems = p.getMinItems(); String itemName = null; if (p.getExtensions() != null && p.getExtensions().get("x-item-name") != null) { itemName = p.getExtensions().get("x-item-name").toString(); @@ -3365,6 +3280,7 @@ public class DefaultCodegen implements CodegenConfig { property.isMap = true; property.containerType = "map"; property.baseType = getSchemaType(p); + // TODO remove this hack in the future, code should use minProperties and maxProperties for object schemas property.minItems = p.getMinProperties(); property.maxItems = p.getMaxProperties(); @@ -3983,20 +3899,6 @@ public class DefaultCodegen implements CodegenConfig { public CodegenResponse fromResponse(String responseCode, ApiResponse response) { CodegenResponse r = CodegenModelFactory.newInstance(CodegenModelType.RESPONSE); - if (response.getContent() != null && response.getContent().size() > 0) { - // Ensure validation properties from a target schema are persisted on CodegenResponse. - // This ignores any edge case where different schemas have different validations because we don't - // have a way to indicate a preference for response schema and are effective 1:1. - Schema contentSchema = null; - for (MediaType mt : response.getContent().values()) { - if (contentSchema != null) break; - contentSchema = mt.getSchema(); - } - if (contentSchema != null) { - ModelUtils.syncValidationProperties(contentSchema, r); - } - } - if ("default".equals(responseCode) || "defaultResponse".equals(responseCode)) { r.code = "0"; r.isDefault = true; @@ -4030,8 +3932,11 @@ public class DefaultCodegen implements CodegenConfig { responseSchema = ModelUtils.getSchemaFromResponse(response); } r.schema = responseSchema; - if (responseSchema != null && responseSchema.getPattern() != null) { - r.setPattern(toRegularExpression(responseSchema.getPattern())); + if (responseSchema != null) { + ModelUtils.syncValidationProperties(responseSchema, r); + if (responseSchema.getPattern() != null) { + r.setPattern(toRegularExpression(responseSchema.getPattern())); + } } r.message = escapeText(response.getDescription()); @@ -4219,20 +4124,6 @@ public class DefaultCodegen implements CodegenConfig { public CodegenParameter fromParameter(Parameter parameter, Set imports) { CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER); - if (parameter.getContent() != null && parameter.getContent().size() > 0) { - // Ensure validation properties from a target schema are persisted on CodegenParameter. - // This ignores any edge case where different schemas have different validations because we don't - // have a way to indicate a preference for parameter schema and are effective 1:1. - Schema contentSchema = null; - for (MediaType mt : parameter.getContent().values()) { - if (contentSchema != null) break; - contentSchema = mt.getSchema(); - } - if (contentSchema != null) { - ModelUtils.syncValidationProperties(contentSchema, codegenParameter); - } - } - codegenParameter.baseName = parameter.getName(); codegenParameter.description = escapeText(parameter.getDescription()); codegenParameter.unescapedDescription = parameter.getDescription(); @@ -4271,6 +4162,7 @@ public class DefaultCodegen implements CodegenConfig { LOGGER.warn("warning! Schema not found for parameter \"" + parameter.getName() + "\", using String"); parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition."); } + ModelUtils.syncValidationProperties(parameterSchema, codegenParameter); if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec codegenParameter.isNullable = true; @@ -6029,9 +5921,10 @@ public class DefaultCodegen implements CodegenConfig { if (StringUtils.isNotBlank(schema.get$ref())) { name = ModelUtils.getSimpleRef(schema.get$ref()); } + Schema validationSchema = unaliasSchema(schema, importMapping); schema = ModelUtils.getReferencedSchema(this.openAPI, schema); - ModelUtils.syncValidationProperties(schema, codegenParameter); + ModelUtils.syncValidationProperties(validationSchema, codegenParameter); if (ModelUtils.isMapSchema(schema)) { // Schema with additionalproperties: true (including composed schemas with additionalproperties: true) @@ -6159,12 +6052,6 @@ public class DefaultCodegen implements CodegenConfig { codegenParameter.dataType = codegenProperty.dataType; codegenParameter.description = codegenProperty.description; codegenParameter.paramName = toParamName(codegenParameter.baseName); - codegenParameter.minimum = codegenProperty.minimum; - codegenParameter.maximum = codegenProperty.maximum; - codegenParameter.exclusiveMinimum = codegenProperty.exclusiveMinimum; - codegenParameter.exclusiveMaximum = codegenProperty.exclusiveMaximum; - codegenParameter.minLength = codegenProperty.minLength; - codegenParameter.maxLength = codegenProperty.maxLength; codegenParameter.pattern = codegenProperty.pattern; codegenParameter.isNullable = codegenProperty.isNullable; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java index 9b0ad0f89f9..3d9cd65af29 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java @@ -94,4 +94,8 @@ public interface IJsonSchemaValidationProperties { boolean getIsNull(); void setIsNull(boolean isNull); + + boolean getHasValidation(); + + void setHasValidation(boolean hasValidation); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java index 2ad0470bc15..f570c562930 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java @@ -1489,30 +1489,89 @@ public class ModelUtils { public static void syncValidationProperties(Schema schema, IJsonSchemaValidationProperties target) { if (schema != null && target != null) { - target.setPattern(schema.getPattern()); - BigDecimal minimum = schema.getMinimum(); - BigDecimal maximum = schema.getMaximum(); - Boolean exclusiveMinimum = schema.getExclusiveMinimum(); - Boolean exclusiveMaximum = schema.getExclusiveMaximum(); - Integer minLength = schema.getMinLength(); - Integer maxLength = schema.getMaxLength(); + if (isNullType(schema) || schema.get$ref() != null || isBooleanSchema(schema)) { + return; + } + boolean isAnyType = (schema.getClass().equals(Schema.class) && schema.get$ref() == null && schema.getType() == null && + (schema.getProperties() == null || schema.getProperties().isEmpty()) && + schema.getAdditionalProperties() == null && schema.getNot() == null && + schema.getEnum() == null); + if (isAnyType) { + return; + } Integer minItems = schema.getMinItems(); Integer maxItems = schema.getMaxItems(); Boolean uniqueItems = schema.getUniqueItems(); Integer minProperties = schema.getMinProperties(); Integer maxProperties = schema.getMaxProperties(); + Integer minLength = schema.getMinLength(); + Integer maxLength = schema.getMaxLength(); + String pattern = schema.getPattern(); + BigDecimal multipleOf = schema.getMultipleOf(); + BigDecimal minimum = schema.getMinimum(); + BigDecimal maximum = schema.getMaximum(); + Boolean exclusiveMinimum = schema.getExclusiveMinimum(); + Boolean exclusiveMaximum = schema.getExclusiveMaximum(); - if (minimum != null) target.setMinimum(String.valueOf(minimum)); - if (maximum != null) target.setMaximum(String.valueOf(maximum)); + if (isArraySchema(schema)) { + setArrayValidations(minItems, maxItems, uniqueItems, target); + } else if (isMapSchema(schema) || isObjectSchema(schema)) { + setObjectValidations(minProperties, maxProperties, target); + } else if (isStringSchema(schema)) { + setStringValidations(minLength, maxLength, pattern, target); + if (isDecimalSchema(schema)) { + setNumericValidations(schema, multipleOf, minimum, maximum, exclusiveMinimum, exclusiveMaximum, target); + } + } else if (isNumberSchema(schema) || isIntegerSchema(schema)) { + setNumericValidations(schema, multipleOf, minimum, maximum, exclusiveMinimum, exclusiveMaximum, target); + } else if (isComposedSchema(schema)) { + // this could be composed out of anything so set all validations here + setArrayValidations(minItems, maxItems, uniqueItems, target); + setObjectValidations(minProperties, maxProperties, target); + setStringValidations(minLength, maxLength, pattern, target); + setNumericValidations(schema, multipleOf, minimum, maximum, exclusiveMinimum, exclusiveMaximum, target); + } + + if (maxItems != null || minItems != null || minProperties != null || maxProperties != null || minLength != null || maxLength != null || multipleOf != null || pattern != null || minimum != null || maximum != null || exclusiveMinimum != null || exclusiveMaximum != null || uniqueItems != null) { + target.setHasValidation(true); + } + } + } + + private static void setArrayValidations(Integer minItems, Integer maxItems, Boolean uniqueItems, IJsonSchemaValidationProperties target) { + if (minItems != null) target.setMinItems(minItems); + if (maxItems != null) target.setMaxItems(maxItems); + if (uniqueItems != null) target.setUniqueItems(uniqueItems); + } + + private static void setObjectValidations(Integer minProperties, Integer maxProperties, IJsonSchemaValidationProperties target) { + if (minProperties != null) target.setMinProperties(minProperties); + if (maxProperties != null) target.setMaxProperties(maxProperties); + } + + private static void setStringValidations(Integer minLength, Integer maxLength, String pattern, IJsonSchemaValidationProperties target) { + if (minLength != null) target.setMinLength(minLength); + if (maxLength != null) target.setMaxLength(maxLength); + if (pattern != null) target.setPattern(pattern); + } + + private static void setNumericValidations(Schema schema, BigDecimal multipleOf, BigDecimal minimum, BigDecimal maximum, Boolean exclusiveMinimum, Boolean exclusiveMaximum, IJsonSchemaValidationProperties target) { + if (multipleOf != null) target.setMultipleOf(multipleOf); + if (minimum != null) { + if (isIntegerSchema(schema)) { + target.setMinimum(String.valueOf(minimum.longValue())); + } else { + target.setMinimum(String.valueOf(minimum)); + } if (exclusiveMinimum != null) target.setExclusiveMinimum(exclusiveMinimum); + } + if (maximum != null) { + if (isIntegerSchema(schema)) { + target.setMaximum(String.valueOf(maximum.longValue())); + } else { + target.setMaximum(String.valueOf(maximum)); + } if (exclusiveMaximum != null) target.setExclusiveMaximum(exclusiveMaximum); - if (minLength != null) target.setMinLength(minLength); - if (maxLength != null) target.setMaxLength(maxLength); - if (minItems != null) target.setMinItems(minItems); - if (maxItems != null) target.setMaxItems(maxItems); - if (uniqueItems != null) target.setUniqueItems(uniqueItems); - if (minProperties != null) target.setMinProperties(minProperties); - if (maxProperties != null) target.setMaxProperties(maxProperties); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index 87959fbb2ed..7042e13c2a7 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -2651,6 +2651,227 @@ public class DefaultCodegenTest { assertEquals(co.responses.get(0).isNull, true); } + @Test + public void testModelGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + Schema sc; + CodegenModel cm; + + List modelNames = Arrays.asList( + "ArrayWithMaxItems", + "ArrayWithMinItems", + "ArrayWithUniqueItems", + "ObjectWithMinProperties", + "ObjectWithMaxProperties", + "StringWithMinLength", + "DateWithMinLength", + "DateTimeWithMinLength", + "ByteWithMinLength", + "BinaryWithMinLength", + "StringWithMaxLength", + "DateWithMaxLength", + "DateTimeWithMaxLength", + "ByteWithMaxLength", + "BinaryWithMaxLength", + "IntegerWithMultipleOf", + "Integer32WithMultipleOf", + "Integer64WithMultipleOf", + "NumberWithMultipleOf", + "NumberFloatWithMultipleOf", + "NumberDoubleWithMultipleOf", + "StringWithPattern", + "DateWithPattern", + "DateTimeWithPattern", + "ByteWithPattern", + "BinaryWithPattern", + "IntegerWithMinimum", + "Integer32WithMinimum", + "Integer64WithMinimum", + "NumberWithMinimum", + "NumberFloatWithMinimum", + "NumberDoubleWithMinimum", + "IntegerWithMaximum", + "Integer32WithMaximum", + "Integer64WithMaximum", + "NumberWithMaximum", + "NumberFloatWithMaximum", + "NumberDoubleWithMaximum", + "IntegerWithExclusiveMaximum", + "Integer32WithExclusiveMaximum", + "Integer64WithExclusiveMaximum", + "NumberWithExclusiveMaximum", + "NumberFloatWithExclusiveMaximum", + "NumberDoubleWithExclusiveMaximum", + "IntegerWithExclusiveMinimum", + "Integer32WithExclusiveMinimum", + "Integer64WithExclusiveMinimum", + "NumberWithExclusiveMinimum", + "NumberFloatWithExclusiveMinimum", + "NumberDoubleWithExclusiveMinimum" + ); + for (String modelName : modelNames) { + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + assertEquals(cm.getHasValidation(), true); + } + } + + @Test + public void testPropertyGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + String modelName = "ObjectWithPropertiesThatHaveValidations"; + Schema sc = openAPI.getComponents().getSchemas().get(modelName);; + CodegenModel cm = codegen.fromModel(modelName, sc); + + List props = cm.getVars(); + assertEquals(props.size(), 50); + for (CodegenProperty prop : props) { + assertEquals(prop.getHasValidation(), true); + } + } + + @Test + public void testQueryParametersGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + String path = "/queryParametersWithValidation"; + Operation operation = openAPI.getPaths().get(path).getPost(); + CodegenOperation co = codegen.fromOperation(path, "POST", operation, null); + List params = co.queryParams; + assertEquals(params.size(), 50); + for (CodegenParameter param : params) { + assertEquals(param.getHasValidation(), true); + } + } + + @Test + public void testHeaderParametersGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + String path = "/headerParametersWithValidation"; + Operation operation = openAPI.getPaths().get(path).getPost(); + CodegenOperation co = codegen.fromOperation(path, "POST", operation, null); + List params = co.headerParams; + assertEquals(params.size(), 50); + for (CodegenParameter param : params) { + assertEquals(param.getHasValidation(), true); + } + } + + @Test + public void testCookieParametersGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + String path = "/cookieParametersWithValidation"; + Operation operation = openAPI.getPaths().get(path).getPost(); + CodegenOperation co = codegen.fromOperation(path, "POST", operation, null); + List params = co.cookieParams; + assertEquals(params.size(), 50); + for (CodegenParameter param : params) { + assertEquals(param.getHasValidation(), true); + } + } + + @Test + public void testPathParametersGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + String path = "/pathParametersWithValidation"; + Operation operation = openAPI.getPaths().get(path).getPost(); + CodegenOperation co = codegen.fromOperation(path, "POST", operation, null); + List params = co.pathParams; + assertEquals(params.size(), 50); + for (CodegenParameter param : params) { + assertEquals(param.getHasValidation(), true); + } + } + + @Test + public void testBodyAndResponseGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + List modelNames = Arrays.asList( + "ArrayWithMaxItems", + "ArrayWithMinItems", + "ArrayWithUniqueItems", + "ObjectWithMinProperties", + "ObjectWithMaxProperties", + "StringWithMinLength", + "DateWithMinLength", + "DateTimeWithMinLength", + "ByteWithMinLength", + "BinaryWithMinLength", + "StringWithMaxLength", + "DateWithMaxLength", + "DateTimeWithMaxLength", + "ByteWithMaxLength", + "BinaryWithMaxLength", + "StringWithPattern", + "DateWithPattern", + "DateTimeWithPattern", + "ByteWithPattern", + "BinaryWithPattern", + "IntegerWithMultipleOf", + "Integer32WithMultipleOf", + "Integer64WithMultipleOf", + "NumberWithMultipleOf", + "NumberFloatWithMultipleOf", + "NumberDoubleWithMultipleOf", + "IntegerWithMinimum", + "Integer32WithMinimum", + "Integer64WithMinimum", + "NumberWithMinimum", + "NumberFloatWithMinimum", + "NumberDoubleWithMinimum", + "IntegerWithMaximum", + "Integer32WithMaximum", + "Integer64WithMaximum", + "NumberWithMaximum", + "NumberFloatWithMaximum", + "NumberDoubleWithMaximum", + "IntegerWithExclusiveMaximum", + "Integer32WithExclusiveMaximum", + "Integer64WithExclusiveMaximum", + "NumberWithExclusiveMaximum", + "NumberFloatWithExclusiveMaximum", + "NumberDoubleWithExclusiveMaximum", + "IntegerWithExclusiveMinimum", + "Integer32WithExclusiveMinimum", + "Integer64WithExclusiveMinimum", + "NumberWithExclusiveMinimum", + "NumberFloatWithExclusiveMinimum", + "NumberDoubleWithExclusiveMinimum" + ); + + String path; + Operation operation; + CodegenOperation co; + + for (String modelName : modelNames) { + path = "/"+modelName; + operation = openAPI.getPaths().get(path).getPost(); + co = codegen.fromOperation(path, "POST", operation, null); + assertEquals(co.bodyParam.getHasValidation(), true); + assertEquals(co.responses.get(0).getHasValidation(), true); + } + } + @Test public void testVarsAndRequiredVarsPresent() { final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7613.yaml"); diff --git a/modules/openapi-generator/src/test/resources/3_0/issue_7651.yaml b/modules/openapi-generator/src/test/resources/3_0/issue_7651.yaml index f35d64b4b35..eeb27cace99 100644 --- a/modules/openapi-generator/src/test/resources/3_0/issue_7651.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/issue_7651.yaml @@ -12,6 +12,2332 @@ tags: - name: isX description: an api that ensures that isX properties are present on Schema classes paths: + /ArrayWithMaxItems: + post: + tags: + - isX + operationId: ArrayWithMaxItems + requestBody: + content: + application/json: + schema: + type: array + maxItems: 2 + items: + type: string + responses: + 200: + description: success + content: + application/json: + schema: + type: array + maxItems: 2 + items: + type: string + /ArrayWithMinItems: + post: + tags: + - isX + operationId: ArrayWithMinItems + requestBody: + content: + application/json: + schema: + type: array + minItems: 2 + items: + type: string + responses: + 200: + description: success + content: + application/json: + schema: + type: array + minItems: 2 + items: + type: string + /ArrayWithUniqueItems: + post: + tags: + - isX + operationId: ArrayWithUniqueItems + requestBody: + content: + application/json: + schema: + type: array + uniqueItems: true + items: + type: string + responses: + 200: + description: success + content: + application/json: + schema: + type: array + uniqueItems: true + items: + type: string + /ObjectWithMinProperties: + post: + tags: + - isX + operationId: ObjectWithMinProperties + requestBody: + content: + application/json: + schema: + type: object + minProperties: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: object + minProperties: 2 + /ObjectWithMaxProperties: + post: + tags: + - isX + operationId: ObjectWithMaxProperties + requestBody: + content: + application/json: + schema: + type: object + maxProperties: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: object + maxProperties: 2 + /StringWithMinLength: + post: + tags: + - isX + operationId: StringWithMinLength + requestBody: + content: + application/json: + schema: + type: string + minLength: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + minLength: 1 + /DateWithMinLength: + post: + tags: + - isX + operationId: DateWithMinLength + requestBody: + content: + application/json: + schema: + type: string + format: date + minLength: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date + minLength: 1 + /DateTimeWithMinLength: + post: + tags: + - isX + operationId: DateTimeWithMinLength + requestBody: + content: + application/json: + schema: + type: string + format: date-time + minLength: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date-time + minLength: 1 + /ByteWithMinLength: + post: + tags: + - isX + operationId: ByteWithMinLength + requestBody: + content: + application/json: + schema: + type: string + format: byte + minLength: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: byte + minLength: 1 + /BinaryWithMinLength: + post: + tags: + - isX + operationId: BinaryWithMinLength + requestBody: + content: + application/json: + schema: + type: string + format: binary + minLength: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: binary + minLength: 1 + /StringWithMaxLength: + post: + tags: + - isX + operationId: StringWithMaxLength + requestBody: + content: + application/json: + schema: + type: string + maxLength: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + maxLength: 10 + /DateWithMaxLength: + post: + tags: + - isX + operationId: DateWithMaxLength + requestBody: + content: + application/json: + schema: + type: string + format: date + maxLength: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date + maxLength: 10 + /DateTimeWithMaxLength: + post: + tags: + - isX + operationId: DateTimeWithMaxLength + requestBody: + content: + application/json: + schema: + type: string + format: date-time + maxLength: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date-time + maxLength: 10 + /ByteWithMaxLength: + post: + tags: + - isX + operationId: ByteWithMaxLength + requestBody: + content: + application/json: + schema: + type: string + format: byte + maxLength: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: byte + maxLength: 10 + /BinaryWithMaxLength: + post: + tags: + - isX + operationId: BinaryWithMaxLength + requestBody: + content: + application/json: + schema: + type: string + format: binary + maxLength: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: binary + maxLength: 10 + /StringWithPattern: + post: + tags: + - isX + operationId: StringWithPattern + requestBody: + content: + application/json: + schema: + type: string + pattern: '^2021.+' + responses: + 200: + description: success + content: + application/json: + schema: + type: string + pattern: '^2021.+' + /DateWithPattern: + post: + tags: + - isX + operationId: DateWithPattern + requestBody: + content: + application/json: + schema: + type: string + format: date + pattern: '^2021.+' + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date + pattern: '^2021.+' + /DateTimeWithPattern: + post: + tags: + - isX + operationId: DateTimeWithPattern + requestBody: + content: + application/json: + schema: + type: string + format: date-time + pattern: '^2021.+' + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date-time + pattern: '^2021.+' + /ByteWithPattern: + post: + tags: + - isX + operationId: ByteWithPattern + requestBody: + content: + application/json: + schema: + type: string + format: byte + pattern: '^2021.+' + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: byte + pattern: '^2021.+' + /BinaryWithPattern: + post: + tags: + - isX + operationId: BinaryWithPattern + requestBody: + content: + application/json: + schema: + type: string + format: binary + pattern: '^2021.+' + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: binary + pattern: '^2021.+' + /IntegerWithMultipleOf: + post: + tags: + - isX + operationId: IntegerWithMultipleOf + requestBody: + content: + application/json: + schema: + type: integer + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + multipleOf: 2 + /Integer32WithMultipleOf: + post: + tags: + - isX + operationId: Integer32WithMultipleOf + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int32 + multipleOf: 2 + /Integer64WithMultipleOf: + post: + tags: + - isX + operationId: Integer64WithMultipleOf + requestBody: + content: + application/json: + schema: + type: integer + format: int64 + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int64 + multipleOf: 2 + /NumberWithMultipleOf: + post: + tags: + - isX + operationId: NumberWithMultipleOf + requestBody: + content: + application/json: + schema: + type: number + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + multipleOf: 2 + /NumberFloatWithMultipleOf: + post: + tags: + - isX + operationId: NumberFloatWithMultipleOf + requestBody: + content: + application/json: + schema: + type: number + format: float + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: float + multipleOf: 2 + /NumberDoubleWithMultipleOf: + post: + tags: + - isX + operationId: NumberDoubleWithMultipleOf + requestBody: + content: + application/json: + schema: + type: number + format: double + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: double + multipleOf: 2 + /IntegerWithMinimum: + post: + tags: + - isX + operationId: IntegerWithMinimum + requestBody: + content: + application/json: + schema: + type: integer + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + minimum: 1 + /Integer32WithMinimum: + post: + tags: + - isX + operationId: Integer32WithMinimum + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int32 + minimum: 1 + /Integer64WithMinimum: + post: + tags: + - isX + operationId: Integer64WithMinimum + requestBody: + content: + application/json: + schema: + type: integer + format: int64 + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int64 + minimum: 1 + /NumberWithMinimum: + post: + tags: + - isX + operationId: NumberWithMinimum + requestBody: + content: + application/json: + schema: + type: number + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + minimum: 1 + /NumberFloatWithMinimum: + post: + tags: + - isX + operationId: NumberFloatWithMinimum + requestBody: + content: + application/json: + schema: + type: number + format: float + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: float + minimum: 1 + /NumberDoubleWithMinimum: + post: + tags: + - isX + operationId: NumberDoubleWithMinimum + requestBody: + content: + application/json: + schema: + type: number + format: double + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: double + minimum: 1 + /IntegerWithMaximum: + post: + tags: + - isX + operationId: IntegerWithMaximum + requestBody: + content: + application/json: + schema: + type: integer + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + maximum: 10 + /Integer32WithMaximum: + post: + tags: + - isX + operationId: Integer32WithMaximum + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int32 + maximum: 10 + /Integer64WithMaximum: + post: + tags: + - isX + operationId: Integer64WithMaximum + requestBody: + content: + application/json: + schema: + type: integer + format: int64 + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int64 + maximum: 10 + /NumberWithMaximum: + post: + tags: + - isX + operationId: NumberWithMaximum + requestBody: + content: + application/json: + schema: + type: number + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + maximum: 10 + /NumberFloatWithMaximum: + post: + tags: + - isX + operationId: NumberFloatWithMaximum + requestBody: + content: + application/json: + schema: + type: number + format: float + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: float + maximum: 10 + /NumberDoubleWithMaximum: + post: + tags: + - isX + operationId: NumberDoubleWithMaximum + requestBody: + content: + application/json: + schema: + type: number + format: double + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: double + maximum: 10 + /IntegerWithExclusiveMaximum: + post: + tags: + - isX + operationId: IntegerWithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + /Integer32WithExclusiveMaximum: + post: + tags: + - isX + operationId: Integer32WithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + /Integer64WithExclusiveMaximum: + post: + tags: + - isX + operationId: Integer64WithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + /NumberWithExclusiveMaximum: + post: + tags: + - isX + operationId: NumberWithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: number + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + maximum: 10 + exclusiveMaximum: true + /NumberFloatWithExclusiveMaximum: + post: + tags: + - isX + operationId: NumberFloatWithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + /NumberDoubleWithExclusiveMaximum: + post: + tags: + - isX + operationId: NumberDoubleWithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + /IntegerWithExclusiveMinimum: + post: + tags: + - isX + operationId: IntegerWithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + /Integer32WithExclusiveMinimum: + post: + tags: + - isX + operationId: Integer32WithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + /Integer64WithExclusiveMinimum: + post: + tags: + - isX + operationId: Integer64WithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: integer + format: int64 + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int64 + minimum: 1 + exclusiveMinimum: true + /NumberWithExclusiveMinimum: + post: + tags: + - isX + operationId: NumberWithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: number + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + minimum: 1 + exclusiveMinimum: true + /NumberFloatWithExclusiveMinimum: + post: + tags: + - isX + operationId: NumberFloatWithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + /NumberDoubleWithExclusiveMinimum: + post: + tags: + - isX + operationId: NumberDoubleWithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + /pathParametersWithValidation: + post: + tags: + - isX + operationId: pathParametersWithValidation + parameters: + - name: ArrayWithMaxItems + in: path + schema: + type: array + maxItems: 2 + items: + type: string + - name: ArrayWithMinItems + in: path + schema: + type: array + minItems: 2 + items: + type: string + - name: ArrayWithUniqueItems + in: path + schema: + type: array + uniqueItems: true + items: + type: string + - name: ObjectWithMinProperties + in: path + schema: + type: object + minProperties: 2 + - name: ObjectWithMaxProperties + in: path + schema: + type: object + maxProperties: 2 + - name: StringWithMinLength + in: path + schema: + type: string + minLength: 1 + - name: DateWithMinLength + in: path + schema: + type: string + format: date + minLength: 10 + - name: DateTimeWithMinLength + in: path + schema: + type: string + format: date-time + minLength: 20 + - name: ByteWithMinLength + in: path + schema: + type: string + format: byte + minLength: 10 + - name: BinaryWithMinLength + in: path + schema: + type: string + format: binary + minLength: 10 + - name: StringWithMaxLength + in: path + schema: + type: string + maxLength: 1 + - name: DateWithMaxLength + in: path + schema: + type: string + format: date + maxLength: 10 + - name: DateTimeWithMaxLength + in: path + schema: + type: string + format: date-time + maxLength: 20 + - name: ByteWithMaxLength + in: path + schema: + type: string + format: byte + maxLength: 10 + - name: BinaryWithMaxLength + in: path + schema: + type: string + format: binary + maxLength: 10 + - name: IntegerWithMultipleOf + in: path + schema: + type: integer + multipleOf: 2 + - name: Integer32WithMultipleOf + in: path + schema: + type: integer + format: int32 + multipleOf: 2 + - name: Integer64WithMultipleOf + in: path + schema: + type: integer + format: int64 + multipleOf: 2 + - name: NumberWithMultipleOf + in: path + schema: + type: number + multipleOf: 2 + - name: NumberFloatWithMultipleOf + in: path + schema: + type: number + format: float + multipleOf: 2 + - name: NumberDoubleWithMultipleOf + in: path + schema: + type: number + format: double + multipleOf: 2 + - name: StringWithPattern + in: path + schema: + type: string + pattern: '^2021.+' + - name: DateWithPattern + in: path + schema: + type: string + format: date + pattern: '^2021.+' + - name: DateTimeWithPattern + in: path + schema: + type: string + format: date-time + pattern: '^2021.+' + - name: ByteWithPattern + in: path + schema: + type: string + format: byte + pattern: '^2021.+' + - name: BinaryWithPattern + in: path + schema: + type: string + format: binary + pattern: '^2021.+' + - name: IntegerWithMinimum + in: path + schema: + type: integer + minimum: 1 + - name: Integer32WithMinimum + in: path + schema: + type: integer + format: int32 + minimum: 1 + - name: Integer64WithMinimum + in: path + schema: + type: integer + format: int364 + minimum: 1 + - name: NumberWithMinimum + in: path + schema: + type: number + minimum: 1 + - name: NumberFloatWithMinimum + in: path + schema: + type: number + format: float + minimum: 1 + - name: NumberDoubleWithMinimum + in: path + schema: + type: number + format: double + minimum: 1 + - name: IntegerWithMaximum + in: path + schema: + type: integer + maximum: 10 + - name: Integer32WithMaximum + in: path + schema: + type: integer + format: int32 + maximum: 10 + - name: Integer64WithMaximum + in: path + schema: + type: integer + format: int64 + maximum: 10 + - name: NumberWithMaximum + in: path + schema: + type: number + maximum: 10 + - name: NumberFloatWithMaximum + in: path + schema: + type: number + format: float + maximum: 10 + - name: NumberDoubleWithMaximum + in: path + schema: + type: number + format: double + maximum: 10 + - name: IntegerWithExclusiveMinimum + in: path + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + - name: Integer32WithExclusiveMinimum + in: path + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + - name: Integer64WithExclusiveMinimum + in: path + schema: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + - name: NumberWithExclusiveMinimum + in: path + schema: + type: number + minimum: 1 + exclusiveMinimum: true + - name: NumberFloatWithExclusiveMinimum + in: path + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + - name: NumberDoubleWithExclusiveMinimum + in: path + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + - name: IntegerWithExclusiveMaximum + in: path + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + - name: Integer32WithExclusiveMaximum + in: path + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + - name: Integer64WithExclusiveMaximum + in: path + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + - name: NumberWithExclusiveMaximum + in: path + schema: + type: number + maximum: 10 + exclusiveMaximum: true + - name: NumberFloatWithExclusiveMaximum + in: path + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + - name: NumberDoubleWithExclusiveMaximum + in: path + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + requestBody: + content: + application/json: + schema: + type: string + required: true + responses: + 200: + description: success + content: + application/json: + schema: + type: string + /cookieParametersWithValidation: + post: + tags: + - isX + operationId: cookieParametersWithValidation + parameters: + - name: ArrayWithMaxItems + in: cookie + schema: + type: array + maxItems: 2 + items: + type: string + - name: ArrayWithMinItems + in: cookie + schema: + type: array + minItems: 2 + items: + type: string + - name: ArrayWithUniqueItems + in: cookie + schema: + type: array + uniqueItems: true + items: + type: string + - name: ObjectWithMinProperties + in: cookie + schema: + type: object + minProperties: 2 + - name: ObjectWithMaxProperties + in: cookie + schema: + type: object + maxProperties: 2 + - name: StringWithMinLength + in: cookie + schema: + type: string + minLength: 1 + - name: DateWithMinLength + in: cookie + schema: + type: string + format: date + minLength: 10 + - name: DateTimeWithMinLength + in: cookie + schema: + type: string + format: date-time + minLength: 20 + - name: ByteWithMinLength + in: cookie + schema: + type: string + format: byte + minLength: 10 + - name: BinaryWithMinLength + in: cookie + schema: + type: string + format: binary + minLength: 10 + - name: StringWithMaxLength + in: cookie + schema: + type: string + maxLength: 1 + - name: DateWithMaxLength + in: cookie + schema: + type: string + format: date + maxLength: 10 + - name: DateTimeWithMaxLength + in: cookie + schema: + type: string + format: date-time + maxLength: 20 + - name: ByteWithMaxLength + in: cookie + schema: + type: string + format: byte + maxLength: 10 + - name: BinaryWithMaxLength + in: cookie + schema: + type: string + format: binary + maxLength: 10 + - name: IntegerWithMultipleOf + in: cookie + schema: + type: integer + multipleOf: 2 + - name: Integer32WithMultipleOf + in: cookie + schema: + type: integer + format: int32 + multipleOf: 2 + - name: Integer64WithMultipleOf + in: cookie + schema: + type: integer + format: int64 + multipleOf: 2 + - name: NumberWithMultipleOf + in: cookie + schema: + type: number + multipleOf: 2 + - name: NumberFloatWithMultipleOf + in: cookie + schema: + type: number + format: float + multipleOf: 2 + - name: NumberDoubleWithMultipleOf + in: cookie + schema: + type: number + format: double + multipleOf: 2 + - name: StringWithPattern + in: cookie + schema: + type: string + pattern: '^2021.+' + - name: DateWithPattern + in: cookie + schema: + type: string + format: date + pattern: '^2021.+' + - name: DateTimeWithPattern + in: cookie + schema: + type: string + format: date-time + pattern: '^2021.+' + - name: ByteWithPattern + in: cookie + schema: + type: string + format: byte + pattern: '^2021.+' + - name: BinaryWithPattern + in: cookie + schema: + type: string + format: binary + pattern: '^2021.+' + - name: IntegerWithMinimum + in: cookie + schema: + type: integer + minimum: 1 + - name: Integer32WithMinimum + in: cookie + schema: + type: integer + format: int32 + minimum: 1 + - name: Integer64WithMinimum + in: cookie + schema: + type: integer + format: int364 + minimum: 1 + - name: NumberWithMinimum + in: cookie + schema: + type: number + minimum: 1 + - name: NumberFloatWithMinimum + in: cookie + schema: + type: number + format: float + minimum: 1 + - name: NumberDoubleWithMinimum + in: cookie + schema: + type: number + format: double + minimum: 1 + - name: IntegerWithMaximum + in: cookie + schema: + type: integer + maximum: 10 + - name: Integer32WithMaximum + in: cookie + schema: + type: integer + format: int32 + maximum: 10 + - name: Integer64WithMaximum + in: cookie + schema: + type: integer + format: int64 + maximum: 10 + - name: NumberWithMaximum + in: cookie + schema: + type: number + maximum: 10 + - name: NumberFloatWithMaximum + in: cookie + schema: + type: number + format: float + maximum: 10 + - name: NumberDoubleWithMaximum + in: cookie + schema: + type: number + format: double + maximum: 10 + - name: IntegerWithExclusiveMinimum + in: cookie + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + - name: Integer32WithExclusiveMinimum + in: cookie + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + - name: Integer64WithExclusiveMinimum + in: cookie + schema: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + - name: NumberWithExclusiveMinimum + in: cookie + schema: + type: number + minimum: 1 + exclusiveMinimum: true + - name: NumberFloatWithExclusiveMinimum + in: cookie + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + - name: NumberDoubleWithExclusiveMinimum + in: cookie + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + - name: IntegerWithExclusiveMaximum + in: cookie + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + - name: Integer32WithExclusiveMaximum + in: cookie + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + - name: Integer64WithExclusiveMaximum + in: cookie + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + - name: NumberWithExclusiveMaximum + in: cookie + schema: + type: number + maximum: 10 + exclusiveMaximum: true + - name: NumberFloatWithExclusiveMaximum + in: cookie + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + - name: NumberDoubleWithExclusiveMaximum + in: cookie + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + requestBody: + content: + application/json: + schema: + type: string + required: true + responses: + 200: + description: success + content: + application/json: + schema: + type: string + /headerParametersWithValidation: + post: + tags: + - isX + operationId: headerParametersWithValidation + parameters: + - name: ArrayWithMaxItems + in: header + schema: + type: array + maxItems: 2 + items: + type: string + - name: ArrayWithMinItems + in: header + schema: + type: array + minItems: 2 + items: + type: string + - name: ArrayWithUniqueItems + in: header + schema: + type: array + uniqueItems: true + items: + type: string + - name: ObjectWithMinProperties + in: header + schema: + type: object + minProperties: 2 + - name: ObjectWithMaxProperties + in: header + schema: + type: object + maxProperties: 2 + - name: StringWithMinLength + in: header + schema: + type: string + minLength: 1 + - name: DateWithMinLength + in: header + schema: + type: string + format: date + minLength: 10 + - name: DateTimeWithMinLength + in: header + schema: + type: string + format: date-time + minLength: 20 + - name: ByteWithMinLength + in: header + schema: + type: string + format: byte + minLength: 10 + - name: BinaryWithMinLength + in: header + schema: + type: string + format: binary + minLength: 10 + - name: StringWithMaxLength + in: header + schema: + type: string + maxLength: 1 + - name: DateWithMaxLength + in: header + schema: + type: string + format: date + maxLength: 10 + - name: DateTimeWithMaxLength + in: header + schema: + type: string + format: date-time + maxLength: 20 + - name: ByteWithMaxLength + in: header + schema: + type: string + format: byte + maxLength: 10 + - name: BinaryWithMaxLength + in: header + schema: + type: string + format: binary + maxLength: 10 + - name: IntegerWithMultipleOf + in: header + schema: + type: integer + multipleOf: 2 + - name: Integer32WithMultipleOf + in: header + schema: + type: integer + format: int32 + multipleOf: 2 + - name: Integer64WithMultipleOf + in: header + schema: + type: integer + format: int64 + multipleOf: 2 + - name: NumberWithMultipleOf + in: header + schema: + type: number + multipleOf: 2 + - name: NumberFloatWithMultipleOf + in: header + schema: + type: number + format: float + multipleOf: 2 + - name: NumberDoubleWithMultipleOf + in: header + schema: + type: number + format: double + multipleOf: 2 + - name: StringWithPattern + in: header + schema: + type: string + pattern: '^2021.+' + - name: DateWithPattern + in: header + schema: + type: string + format: date + pattern: '^2021.+' + - name: DateTimeWithPattern + in: header + schema: + type: string + format: date-time + pattern: '^2021.+' + - name: ByteWithPattern + in: header + schema: + type: string + format: byte + pattern: '^2021.+' + - name: BinaryWithPattern + in: header + schema: + type: string + format: binary + pattern: '^2021.+' + - name: IntegerWithMinimum + in: header + schema: + type: integer + minimum: 1 + - name: Integer32WithMinimum + in: header + schema: + type: integer + format: int32 + minimum: 1 + - name: Integer64WithMinimum + in: header + schema: + type: integer + format: int364 + minimum: 1 + - name: NumberWithMinimum + in: header + schema: + type: number + minimum: 1 + - name: NumberFloatWithMinimum + in: header + schema: + type: number + format: float + minimum: 1 + - name: NumberDoubleWithMinimum + in: header + schema: + type: number + format: double + minimum: 1 + - name: IntegerWithMaximum + in: header + schema: + type: integer + maximum: 10 + - name: Integer32WithMaximum + in: header + schema: + type: integer + format: int32 + maximum: 10 + - name: Integer64WithMaximum + in: header + schema: + type: integer + format: int64 + maximum: 10 + - name: NumberWithMaximum + in: header + schema: + type: number + maximum: 10 + - name: NumberFloatWithMaximum + in: header + schema: + type: number + format: float + maximum: 10 + - name: NumberDoubleWithMaximum + in: header + schema: + type: number + format: double + maximum: 10 + - name: IntegerWithExclusiveMinimum + in: header + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + - name: Integer32WithExclusiveMinimum + in: header + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + - name: Integer64WithExclusiveMinimum + in: header + schema: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + - name: NumberWithExclusiveMinimum + in: header + schema: + type: number + minimum: 1 + exclusiveMinimum: true + - name: NumberFloatWithExclusiveMinimum + in: header + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + - name: NumberDoubleWithExclusiveMinimum + in: header + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + - name: IntegerWithExclusiveMaximum + in: header + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + - name: Integer32WithExclusiveMaximum + in: header + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + - name: Integer64WithExclusiveMaximum + in: header + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + - name: NumberWithExclusiveMaximum + in: header + schema: + type: number + maximum: 10 + exclusiveMaximum: true + - name: NumberFloatWithExclusiveMaximum + in: header + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + - name: NumberDoubleWithExclusiveMaximum + in: header + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + requestBody: + content: + application/json: + schema: + type: string + required: true + responses: + 200: + description: success + content: + application/json: + schema: + type: string + /queryParametersWithValidation: + post: + tags: + - isX + operationId: queryParametersWithValidation + parameters: + - name: ArrayWithMaxItems + in: query + schema: + type: array + maxItems: 2 + items: + type: string + - name: ArrayWithMinItems + in: query + schema: + type: array + minItems: 2 + items: + type: string + - name: ArrayWithUniqueItems + in: query + schema: + type: array + uniqueItems: true + items: + type: string + - name: ObjectWithMinProperties + in: query + schema: + type: object + minProperties: 2 + - name: ObjectWithMaxProperties + in: query + schema: + type: object + maxProperties: 2 + - name: StringWithMinLength + in: query + schema: + type: string + minLength: 1 + - name: DateWithMinLength + in: query + schema: + type: string + format: date + minLength: 10 + - name: DateTimeWithMinLength + in: query + schema: + type: string + format: date-time + minLength: 20 + - name: ByteWithMinLength + in: query + schema: + type: string + format: byte + minLength: 10 + - name: BinaryWithMinLength + in: query + schema: + type: string + format: binary + minLength: 10 + - name: StringWithMaxLength + in: query + schema: + type: string + maxLength: 1 + - name: DateWithMaxLength + in: query + schema: + type: string + format: date + maxLength: 10 + - name: DateTimeWithMaxLength + in: query + schema: + type: string + format: date-time + maxLength: 20 + - name: ByteWithMaxLength + in: query + schema: + type: string + format: byte + maxLength: 10 + - name: BinaryWithMaxLength + in: query + schema: + type: string + format: binary + maxLength: 10 + - name: IntegerWithMultipleOf + in: query + schema: + type: integer + multipleOf: 2 + - name: Integer32WithMultipleOf + in: query + schema: + type: integer + format: int32 + multipleOf: 2 + - name: Integer64WithMultipleOf + in: query + schema: + type: integer + format: int64 + multipleOf: 2 + - name: NumberWithMultipleOf + in: query + schema: + type: number + multipleOf: 2 + - name: NumberFloatWithMultipleOf + in: query + schema: + type: number + format: float + multipleOf: 2 + - name: NumberDoubleWithMultipleOf + in: query + schema: + type: number + format: double + multipleOf: 2 + - name: StringWithPattern + in: query + schema: + type: string + pattern: '^2021.+' + - name: DateWithPattern + in: query + schema: + type: string + format: date + pattern: '^2021.+' + - name: DateTimeWithPattern + in: query + schema: + type: string + format: date-time + pattern: '^2021.+' + - name: ByteWithPattern + in: query + schema: + type: string + format: byte + pattern: '^2021.+' + - name: BinaryWithPattern + in: query + schema: + type: string + format: binary + pattern: '^2021.+' + - name: IntegerWithMinimum + in: query + schema: + type: integer + minimum: 1 + - name: Integer32WithMinimum + in: query + schema: + type: integer + format: int32 + minimum: 1 + - name: Integer64WithMinimum + in: query + schema: + type: integer + format: int364 + minimum: 1 + - name: NumberWithMinimum + in: query + schema: + type: number + minimum: 1 + - name: NumberFloatWithMinimum + in: query + schema: + type: number + format: float + minimum: 1 + - name: NumberDoubleWithMinimum + in: query + schema: + type: number + format: double + minimum: 1 + - name: IntegerWithMaximum + in: query + schema: + type: integer + maximum: 10 + - name: Integer32WithMaximum + in: query + schema: + type: integer + format: int32 + maximum: 10 + - name: Integer64WithMaximum + in: query + schema: + type: integer + format: int64 + maximum: 10 + - name: NumberWithMaximum + in: query + schema: + type: number + maximum: 10 + - name: NumberFloatWithMaximum + in: query + schema: + type: number + format: float + maximum: 10 + - name: NumberDoubleWithMaximum + in: query + schema: + type: number + format: double + maximum: 10 + - name: IntegerWithExclusiveMinimum + in: query + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + - name: Integer32WithExclusiveMinimum + in: query + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + - name: Integer64WithExclusiveMinimum + in: query + schema: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + - name: NumberWithExclusiveMinimum + in: query + schema: + type: number + minimum: 1 + exclusiveMinimum: true + - name: NumberFloatWithExclusiveMinimum + in: query + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + - name: NumberDoubleWithExclusiveMinimum + in: query + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + - name: IntegerWithExclusiveMaximum + in: query + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + - name: Integer32WithExclusiveMaximum + in: query + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + - name: Integer64WithExclusiveMaximum + in: query + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + - name: NumberWithExclusiveMaximum + in: query + schema: + type: number + maximum: 10 + exclusiveMaximum: true + - name: NumberFloatWithExclusiveMaximum + in: query + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + - name: NumberDoubleWithExclusiveMaximum + in: query + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + requestBody: + content: + application/json: + schema: + type: string + required: true + responses: + 200: + description: success + content: + application/json: + schema: + type: string /ref_date_with_validation/{date}: post: tags: @@ -124,7 +2450,7 @@ paths: post: tags: - isX - operationId: null + operationId: 'null' parameters: - name: param in: path @@ -148,7 +2474,7 @@ paths: post: tags: - isX - operationId: null + operationId: refNull parameters: - name: param in: path @@ -170,6 +2496,409 @@ paths: $ref: '#/components/schemas/NullModel' components: schemas: + ArrayWithMaxItems: + type: array + maxItems: 2 + items: + type: string + ArrayWithMinItems: + type: array + minItems: 2 + items: + type: string + ArrayWithUniqueItems: + type: array + uniqueItems: true + items: + type: string + ObjectWithMinProperties: + type: object + minProperties: 2 + ObjectWithMaxProperties: + type: object + maxProperties: 2 + StringWithMinLength: + type: string + minLength: 1 + DateWithMinLength: + type: string + format: date + minLength: 10 + DateTimeWithMinLength: + type: string + format: date-time + minLength: 20 + ByteWithMinLength: + type: string + format: byte + minLength: 10 + BinaryWithMinLength: + type: string + format: binary + minLength: 10 + StringWithMaxLength: + type: string + maxLength: 1 + DateWithMaxLength: + type: string + format: date + maxLength: 10 + DateTimeWithMaxLength: + type: string + format: date-time + maxLength: 20 + ByteWithMaxLength: + type: string + format: byte + maxLength: 10 + BinaryWithMaxLength: + type: string + format: binary + maxLength: 10 + IntegerWithMultipleOf: + type: integer + multipleOf: 2 + Integer32WithMultipleOf: + type: integer + format: int32 + multipleOf: 2 + Integer64WithMultipleOf: + type: integer + format: int64 + multipleOf: 2 + NumberWithMultipleOf: + type: number + multipleOf: 2 + NumberFloatWithMultipleOf: + type: number + format: float + multipleOf: 2 + NumberDoubleWithMultipleOf: + type: number + format: double + multipleOf: 2 + StringWithPattern: + type: string + pattern: '^2021.+' + DateWithPattern: + type: string + format: date + pattern: '^2021.+' + DateTimeWithPattern: + type: string + format: date-time + pattern: '^2021.+' + ByteWithPattern: + type: string + format: byte + pattern: '^2021.+' + BinaryWithPattern: + type: string + format: binary + pattern: '^2021.+' + IntegerWithMinimum: + type: integer + minimum: 1 + Integer32WithMinimum: + type: integer + format: int32 + minimum: 1 + Integer64WithMinimum: + type: integer + format: int364 + minimum: 1 + NumberWithMinimum: + type: number + minimum: 1 + NumberFloatWithMinimum: + type: number + format: float + minimum: 1 + NumberDoubleWithMinimum: + type: number + format: double + minimum: 1 + IntegerWithMaximum: + type: integer + maximum: 10 + Integer32WithMaximum: + type: integer + format: int32 + maximum: 10 + Integer64WithMaximum: + type: integer + format: int64 + maximum: 10 + NumberWithMaximum: + type: number + maximum: 10 + NumberFloatWithMaximum: + type: number + format: float + maximum: 10 + NumberDoubleWithMaximum: + type: number + format: double + maximum: 10 + IntegerWithExclusiveMinimum: + type: integer + minimum: 1 + exclusiveMinimum: true + Integer32WithExclusiveMinimum: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + Integer64WithExclusiveMinimum: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + NumberWithExclusiveMinimum: + type: number + minimum: 1 + exclusiveMinimum: true + NumberFloatWithExclusiveMinimum: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + NumberDoubleWithExclusiveMinimum: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + IntegerWithExclusiveMaximum: + type: integer + maximum: 10 + exclusiveMaximum: true + Integer32WithExclusiveMaximum: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + Integer64WithExclusiveMaximum: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + NumberWithExclusiveMaximum: + type: number + maximum: 10 + exclusiveMaximum: true + NumberFloatWithExclusiveMaximum: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + NumberDoubleWithExclusiveMaximum: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + ObjectWithPropertiesThatHaveValidations: + type: object + properties: + ArrayWithMaxItems: + type: array + maxItems: 2 + items: + type: string + ArrayWithMinItems: + type: array + minItems: 2 + items: + type: string + ArrayWithUniqueItems: + type: array + uniqueItems: true + items: + type: string + ObjectWithMinProperties: + type: object + minProperties: 2 + ObjectWithMaxProperties: + type: object + maxProperties: 2 + StringWithMinLength: + type: string + minLength: 1 + DateWithMinLength: + type: string + format: date + minLength: 10 + DateTimeWithMinLength: + type: string + format: date-time + minLength: 20 + ByteWithMinLength: + type: string + format: byte + minLength: 10 + BinaryWithMinLength: + type: string + format: binary + minLength: 10 + StringWithMaxLength: + type: string + maxLength: 1 + DateWithMaxLength: + type: string + format: date + maxLength: 10 + DateTimeWithMaxLength: + type: string + format: date-time + maxLength: 20 + ByteWithMaxLength: + type: string + format: byte + maxLength: 10 + BinaryWithMaxLength: + type: string + format: binary + maxLength: 10 + IntegerWithMultipleOf: + type: integer + multipleOf: 2 + Integer32WithMultipleOf: + type: integer + format: int32 + multipleOf: 2 + Integer64WithMultipleOf: + type: integer + format: int64 + multipleOf: 2 + NumberWithMultipleOf: + type: number + multipleOf: 2 + NumberFloatWithMultipleOf: + type: number + format: float + multipleOf: 2 + NumberDoubleWithMultipleOf: + type: number + format: double + multipleOf: 2 + StringWithPattern: + type: string + pattern: '^2021.+' + DateWithPattern: + type: string + format: date + pattern: '^2021.+' + DateTimeWithPattern: + type: string + format: date-time + pattern: '^2021.+' + ByteWithPattern: + type: string + format: byte + pattern: '^2021.+' + BinaryWithPattern: + type: string + format: binary + pattern: '^2021.+' + IntegerWithMinimum: + type: integer + minimum: 1 + Integer32WithMinimum: + type: integer + format: int32 + minimum: 1 + Integer64WithMinimum: + type: integer + format: int364 + minimum: 1 + NumberWithMinimum: + type: number + minimum: 1 + NumberFloatWithMinimum: + type: number + format: float + minimum: 1 + NumberDoubleWithMinimum: + type: number + format: double + minimum: 1 + IntegerWithMaximum: + type: integer + maximum: 10 + Integer32WithMaximum: + type: integer + format: int32 + maximum: 10 + Integer64WithMaximum: + type: integer + format: int64 + maximum: 10 + NumberWithMaximum: + type: number + maximum: 10 + NumberFloatWithMaximum: + type: number + format: float + maximum: 10 + NumberDoubleWithMaximum: + type: number + format: double + maximum: 10 + IntegerWithExclusiveMinimum: + type: integer + minimum: 1 + exclusiveMinimum: true + Integer32WithExclusiveMinimum: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + Integer64WithExclusiveMinimum: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + NumberWithExclusiveMinimum: + type: number + minimum: 1 + exclusiveMinimum: true + NumberFloatWithExclusiveMinimum: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + NumberDoubleWithExclusiveMinimum: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + IntegerWithExclusiveMaximum: + type: integer + maximum: 10 + exclusiveMaximum: true + Integer32WithExclusiveMaximum: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + Integer64WithExclusiveMaximum: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + NumberWithExclusiveMaximum: + type: number + maximum: 10 + exclusiveMaximum: true + NumberFloatWithExclusiveMaximum: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + NumberDoubleWithExclusiveMaximum: + type: number + format: double + maximum: 10 + exclusiveMaximum: true NullModel: type: 'null' ObjectWithTypeNullProperties: From 90ed1290fafe08306283f9acb74650e5b8d19302 Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Fri, 22 Jan 2021 10:58:27 +0100 Subject: [PATCH 15/54] [dart][dart-dio] Improve form param handling, respect required flag (#8369) * [dart-dio] Improve form param handling, respect required flag * simplify template * respect required flag (only null check when not rquired) * minor formatting * Add additional nullable check --- .../src/main/resources/dart-dio/api.mustache | 23 +++------ .../petstore_client_lib/lib/api/pet_api.dart | 18 +++---- .../petstore_client_lib/lib/api/pet_api.dart | 18 +++---- .../lib/api/fake_api.dart | 51 ++++++++++--------- .../lib/api/pet_api.dart | 29 +++++------ 5 files changed, 61 insertions(+), 78 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache index ee4b9a0579c..3ecff3ef146 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache @@ -52,26 +52,15 @@ class {{classname}} { ];{{/hasConsumes}} {{#hasFormParams}} - final formData = {}; + final formData = { + {{#formParams}} + {{^required}}{{^nullable}}if ({{paramName}} != null) {{/nullable}}{{/required}}r'{{baseName}}': {{#isFile}}MultipartFile.fromBytes({{paramName}}, filename: r'{{baseName}}'){{/isFile}}{{^isFile}}parameterToString(_serializers, {{paramName}}){{/isFile}}, + {{/formParams}} + }; {{#isMultipart}} - {{#formParams}} - {{^isFile}} - if ({{paramName}} != null) { - formData[r'{{baseName}}'] = parameterToString(_serializers, {{paramName}}); - } - {{/isFile}} - {{#isFile}} - if ({{paramName}} != null) { - formData[r'{{baseName}}'] = MultipartFile.fromBytes({{paramName}}, filename: r'{{baseName}}'); - } - {{/isFile}} - {{/formParams}} bodyData = FormData.fromMap(formData); {{/isMultipart}} {{^isMultipart}} - {{#formParams}} - formData['{{baseName}}'] = parameterToString(_serializers, {{paramName}}); - {{/formParams}} bodyData = formData; {{/isMultipart}} {{/hasFormParams}} @@ -89,7 +78,7 @@ class {{classname}} { {{/isContainer}} {{^isContainer}} {{#isPrimitiveType}} - var serializedBody = {{paramName}}; + final serializedBody = {{paramName}}; {{/isPrimitiveType}} {{^isPrimitiveType}} final bodySerializer = _serializers.serializerForType({{{baseType}}}) as Serializer<{{{baseType}}}>; diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index dc84d61c998..795b627fb40 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -427,9 +427,10 @@ class PetApi { 'application/x-www-form-urlencoded', ]; - final formData = {}; - formData['name'] = parameterToString(_serializers, name); - formData['status'] = parameterToString(_serializers, status); + final formData = { + if (name != null) r'name': parameterToString(_serializers, name), + if (status != null) r'status': parameterToString(_serializers, status), + }; bodyData = formData; return _dio.request( @@ -486,13 +487,10 @@ class PetApi { 'multipart/form-data', ]; - final formData = {}; - if (additionalMetadata != null) { - formData[r'additionalMetadata'] = parameterToString(_serializers, additionalMetadata); - } - if (file != null) { - formData[r'file'] = MultipartFile.fromBytes(file, filename: r'file'); - } + final formData = { + if (additionalMetadata != null) r'additionalMetadata': parameterToString(_serializers, additionalMetadata), + if (file != null) r'file': MultipartFile.fromBytes(file, filename: r'file'), + }; bodyData = FormData.fromMap(formData); return _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index 65752e18bae..f91d7d0125a 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -459,9 +459,10 @@ class PetApi { 'application/x-www-form-urlencoded', ]; - final formData = {}; - formData['name'] = parameterToString(_serializers, name); - formData['status'] = parameterToString(_serializers, status); + final formData = { + if (name != null) r'name': parameterToString(_serializers, name), + if (status != null) r'status': parameterToString(_serializers, status), + }; bodyData = formData; return _dio.request( @@ -518,13 +519,10 @@ class PetApi { 'multipart/form-data', ]; - final formData = {}; - if (additionalMetadata != null) { - formData[r'additionalMetadata'] = parameterToString(_serializers, additionalMetadata); - } - if (file != null) { - formData[r'file'] = MultipartFile.fromBytes(file, filename: r'file'); - } + final formData = { + if (additionalMetadata != null) r'additionalMetadata': parameterToString(_serializers, additionalMetadata), + if (file != null) r'file': MultipartFile.fromBytes(file, filename: r'file'), + }; bodyData = FormData.fromMap(formData); return _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart index ade787a58a4..95dd5da583d 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart @@ -175,7 +175,7 @@ class FakeApi { 'application/json', ]; - var serializedBody = body; + final serializedBody = body; final jsonbody = json.encode(serializedBody); bodyData = jsonbody; @@ -306,7 +306,7 @@ class FakeApi { 'application/json', ]; - var serializedBody = body; + final serializedBody = body; final jsonbody = json.encode(serializedBody); bodyData = jsonbody; @@ -369,7 +369,7 @@ class FakeApi { 'application/json', ]; - var serializedBody = body; + final serializedBody = body; final jsonbody = json.encode(serializedBody); bodyData = jsonbody; @@ -619,21 +619,22 @@ class FakeApi { 'application/x-www-form-urlencoded', ]; - final formData = {}; - formData['integer'] = parameterToString(_serializers, integer); - formData['int32'] = parameterToString(_serializers, int32); - formData['int64'] = parameterToString(_serializers, int64); - formData['number'] = parameterToString(_serializers, number); - formData['float'] = parameterToString(_serializers, float); - formData['double'] = parameterToString(_serializers, double_); - formData['string'] = parameterToString(_serializers, string); - formData['pattern_without_delimiter'] = parameterToString(_serializers, patternWithoutDelimiter); - formData['byte'] = parameterToString(_serializers, byte); - formData['binary'] = parameterToString(_serializers, binary); - formData['date'] = parameterToString(_serializers, date); - formData['dateTime'] = parameterToString(_serializers, dateTime); - formData['password'] = parameterToString(_serializers, password); - formData['callback'] = parameterToString(_serializers, callback); + final formData = { + if (integer != null) r'integer': parameterToString(_serializers, integer), + if (int32 != null) r'int32': parameterToString(_serializers, int32), + if (int64 != null) r'int64': parameterToString(_serializers, int64), + r'number': parameterToString(_serializers, number), + if (float != null) r'float': parameterToString(_serializers, float), + r'double': parameterToString(_serializers, double_), + if (string != null) r'string': parameterToString(_serializers, string), + r'pattern_without_delimiter': parameterToString(_serializers, patternWithoutDelimiter), + r'byte': parameterToString(_serializers, byte), + if (binary != null) r'binary': MultipartFile.fromBytes(binary, filename: r'binary'), + if (date != null) r'date': parameterToString(_serializers, date), + if (dateTime != null) r'dateTime': parameterToString(_serializers, dateTime), + if (password != null) r'password': parameterToString(_serializers, password), + if (callback != null) r'callback': parameterToString(_serializers, callback), + }; bodyData = formData; return _dio.request( @@ -701,9 +702,10 @@ class FakeApi { 'application/x-www-form-urlencoded', ]; - final formData = {}; - formData['enum_form_string_array'] = parameterToString(_serializers, enumFormStringArray); - formData['enum_form_string'] = parameterToString(_serializers, enumFormString); + final formData = { + if (enumFormStringArray != null) r'enum_form_string_array': parameterToString(_serializers, enumFormStringArray), + if (enumFormString != null) r'enum_form_string': parameterToString(_serializers, enumFormString), + }; bodyData = formData; return _dio.request( @@ -867,9 +869,10 @@ class FakeApi { 'application/x-www-form-urlencoded', ]; - final formData = {}; - formData['param'] = parameterToString(_serializers, param); - formData['param2'] = parameterToString(_serializers, param2); + final formData = { + r'param': parameterToString(_serializers, param), + r'param2': parameterToString(_serializers, param2), + }; bodyData = formData; return _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart index b5536c892ec..4572f3c2a0d 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart @@ -427,9 +427,10 @@ class PetApi { 'application/x-www-form-urlencoded', ]; - final formData = {}; - formData['name'] = parameterToString(_serializers, name); - formData['status'] = parameterToString(_serializers, status); + final formData = { + if (name != null) r'name': parameterToString(_serializers, name), + if (status != null) r'status': parameterToString(_serializers, status), + }; bodyData = formData; return _dio.request( @@ -486,13 +487,10 @@ class PetApi { 'multipart/form-data', ]; - final formData = {}; - if (additionalMetadata != null) { - formData[r'additionalMetadata'] = parameterToString(_serializers, additionalMetadata); - } - if (file != null) { - formData[r'file'] = MultipartFile.fromBytes(file, filename: r'file'); - } + final formData = { + if (additionalMetadata != null) r'additionalMetadata': parameterToString(_serializers, additionalMetadata), + if (file != null) r'file': MultipartFile.fromBytes(file, filename: r'file'), + }; bodyData = FormData.fromMap(formData); return _dio.request( @@ -565,13 +563,10 @@ class PetApi { 'multipart/form-data', ]; - final formData = {}; - if (additionalMetadata != null) { - formData[r'additionalMetadata'] = parameterToString(_serializers, additionalMetadata); - } - if (requiredFile != null) { - formData[r'requiredFile'] = MultipartFile.fromBytes(requiredFile, filename: r'requiredFile'); - } + final formData = { + if (additionalMetadata != null) r'additionalMetadata': parameterToString(_serializers, additionalMetadata), + r'requiredFile': MultipartFile.fromBytes(requiredFile, filename: r'requiredFile'), + }; bodyData = FormData.fromMap(formData); return _dio.request( From a7a59378137cb1ce70d785f422251928df009846 Mon Sep 17 00:00:00 2001 From: Hugo Alves Date: Sat, 23 Jan 2021 02:33:16 +0000 Subject: [PATCH 16/54] [JAVA][FEIGN]Implement unit tests for java-feign client (#8484) * Implement unit tests for feign client Implement tests Migrate to junit 5 * Default feign client does not support PATCH verb Default feign client does not support PATCH verb * Remove test for GET endpoint with request body * Configure junit in gradle build * Configure logback for unit tests * Add missing dependencies to sbt * Fix gradle dependency * Add logback to gradle unit test * Regenerate samples * Make junit test classes package private * Make junit test classes package private * Update samples * Organize imports * Organize imports --- .../Java/libraries/feign/ApiClient.mustache | 2 + .../Java/libraries/feign/api_test.mustache | 12 +- .../libraries/feign/build.gradle.mustache | 15 +- .../Java/libraries/feign/build.sbt.mustache | 8 +- .../Java/libraries/feign/model_test.mustache | 48 ++ .../Java/libraries/feign/pom.mustache | 41 +- .../java/feign-no-nullable/build.gradle | 15 +- .../petstore/java/feign-no-nullable/build.sbt | 8 +- .../petstore/java/feign-no-nullable/pom.xml | 41 +- .../org/openapitools/client/ApiClient.java | 2 + .../client/petstore/java/feign/build.gradle | 15 +- samples/client/petstore/java/feign/build.sbt | 8 +- samples/client/petstore/java/feign/pom.xml | 41 +- .../org/openapitools/client/ApiClient.java | 2 + .../client/api/AnotherFakeApiTest.java | 17 +- .../openapitools/client/api/FakeApiTest.java | 573 +++++++++--------- .../api/FakeClassnameTags123ApiTest.java | 76 ++- .../openapitools/client/api/PetApiTest.java | 338 ++++++----- .../openapitools/client/api/StoreApiTest.java | 188 ++++-- .../openapitools/client/api/UserApiTest.java | 31 +- .../AdditionalPropertiesAnyTypeTest.java | 11 +- .../model/AdditionalPropertiesArrayTest.java | 11 +- .../AdditionalPropertiesBooleanTest.java | 11 +- .../model/AdditionalPropertiesClassTest.java | 31 +- .../AdditionalPropertiesIntegerTest.java | 11 +- .../model/AdditionalPropertiesNumberTest.java | 11 +- .../model/AdditionalPropertiesObjectTest.java | 11 +- .../model/AdditionalPropertiesStringTest.java | 11 +- .../openapitools/client/model/AnimalTest.java | 13 +- .../model/ArrayOfArrayOfNumberOnlyTest.java | 11 +- .../client/model/ArrayOfNumberOnlyTest.java | 11 +- .../client/model/ArrayTestTest.java | 15 +- .../client/model/BigCatAllOfTest.java | 11 +- .../openapitools/client/model/BigCatTest.java | 17 +- .../client/model/CapitalizationTest.java | 21 +- .../client/model/CatAllOfTest.java | 11 +- .../openapitools/client/model/CatTest.java | 15 +- .../client/model/CategoryTest.java | 13 +- .../client/model/ClassModelTest.java | 11 +- .../openapitools/client/model/ClientTest.java | 11 +- .../client/model/DogAllOfTest.java | 11 +- .../openapitools/client/model/DogTest.java | 15 +- .../client/model/EnumArraysTest.java | 13 +- .../client/model/EnumClassTest.java | 8 +- .../client/model/EnumTestTest.java | 19 +- .../client/model/FileSchemaTestClassTest.java | 13 +- .../client/model/FormatTestTest.java | 37 +- .../client/model/HasOnlyReadOnlyTest.java | 13 +- .../client/model/MapTestTest.java | 17 +- ...rtiesAndAdditionalPropertiesClassTest.java | 15 +- .../client/model/Model200ResponseTest.java | 13 +- .../client/model/ModelApiResponseTest.java | 15 +- .../client/model/ModelReturnTest.java | 11 +- .../openapitools/client/model/NameTest.java | 17 +- .../client/model/NumberOnlyTest.java | 11 +- .../openapitools/client/model/OrderTest.java | 21 +- .../client/model/OuterCompositeTest.java | 15 +- .../client/model/OuterEnumTest.java | 8 +- .../openapitools/client/model/PetTest.java | 21 +- .../client/model/ReadOnlyFirstTest.java | 13 +- .../client/model/SpecialModelNameTest.java | 11 +- .../openapitools/client/model/TagTest.java | 13 +- .../client/model/TypeHolderDefaultTest.java | 19 +- .../client/model/TypeHolderExampleTest.java | 21 +- .../openapitools/client/model/UserTest.java | 25 +- .../client/model/XmlItemTest.java | 67 +- .../feign/src/test/resources/logback-test.xml | 10 + .../java/feign/src/test/resources/pet.json | 18 + .../feign/src/test/resources/pet_list.json | 38 ++ 69 files changed, 1277 insertions(+), 1000 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/feign/model_test.mustache create mode 100644 samples/client/petstore/java/feign/src/test/resources/logback-test.xml create mode 100644 samples/client/petstore/java/feign/src/test/resources/pet.json create mode 100644 samples/client/petstore/java/feign/src/test/resources/pet_list.json diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache index 54201a1c615..4e094dfccbe 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache @@ -8,6 +8,7 @@ import java.util.logging.Logger; {{#threetenbp}} import org.threeten.bp.*; {{/threetenbp}} +import feign.okhttp.OkHttpClient; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -51,6 +52,7 @@ public class ApiClient { objectMapper = createObjectMapper(); apiAuthorizations = new LinkedHashMap(); feignBuilder = Feign.builder() + .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) .decoder(new JacksonDecoder(objectMapper)) .logger(new Slf4jLogger()); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/api_test.mustache index b24c9327129..e9f9d055e02 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/api_test.mustache @@ -3,8 +3,8 @@ package {{package}}; import {{invokerPackage}}.ApiClient; {{#imports}}import {{import}}; {{/imports}} -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeEach; {{^fullJavaUtil}} import java.util.ArrayList; @@ -16,11 +16,11 @@ import java.util.Map; /** * API tests for {{classname}} */ -public class {{classname}}Test { +class {{classname}}Test { private {{classname}} api; - @Before + @BeforeEach public void setup() { api = new ApiClient().buildClient({{classname}}.class); } @@ -32,7 +32,7 @@ public class {{classname}}Test { * {{notes}} */ @Test - public void {{operationId}}Test() { + void {{operationId}}Test() { {{#allParams}} {{{dataType}}} {{paramName}} = null; {{/allParams}} @@ -51,7 +51,7 @@ public class {{classname}}Test { * listing them out individually. */ @Test - public void {{operationId}}TestQueryMap() { + void {{operationId}}TestQueryMap() { {{#allParams}} {{^isQueryParam}} {{{dataType}}} {{paramName}} = null; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache index ae4a04c11b3..eda36125e37 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache @@ -94,6 +94,10 @@ if(hasProperty('target') && target == 'android') { } } +test { + useJUnitPlatform() +} + ext { swagger_annotations_version = "1.5.24" jackson_version = "2.10.3" @@ -106,7 +110,7 @@ ext { {{/threetenbp}} feign_version = "10.11" feign_form_version = "3.8.0" - junit_version = "4.13.1" + junit_version = "5.7.0" scribejava_version = "8.0.0" } @@ -116,6 +120,7 @@ dependencies { implementation "io.github.openfeign:feign-core:$feign_version" implementation "io.github.openfeign:feign-jackson:$feign_version" implementation "io.github.openfeign:feign-slf4j:$feign_version" + implementation "io.github.openfeign:feign-okhttp:$feign_version" implementation "io.github.openfeign.form:feign-form:$feign_form_version" implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" @@ -136,5 +141,11 @@ dependencies { implementation "com.github.scribejava:scribejava-core:$scribejava_version" implementation "com.brsanthu:migbase64:2.2" implementation 'javax.annotation:javax.annotation-api:1.3.2' - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version" + testImplementation "com.github.tomakehurst:wiremock-jre8:2.27.2" + testImplementation "org.hamcrest:hamcrest:2.2" + testImplementation "commons-io:commons-io:2.8.0" + testImplementation "ch.qos.logback:logback-classic:1.2.3" } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache index 218469b0d57..95745cdad26 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache @@ -10,10 +10,12 @@ lazy val root = (project in file(".")). resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( "io.swagger" % "swagger-annotations" % "1.5.24" % "compile", + "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", "io.github.openfeign" % "feign-core" % "10.11" % "compile", "io.github.openfeign" % "feign-jackson" % "10.11" % "compile", "io.github.openfeign" % "feign-slf4j" % "10.11" % "compile", "io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile", + "io.github.openfeign" % "feign-okhttp" % "10.11" % "compile", "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", @@ -22,7 +24,11 @@ lazy val root = (project in file(".")). "com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", - "junit" % "junit" % "4.13.1" % "test", + "org.junit.jupiter" % "junit-jupiter" % "5.7.0" % "test", + "org.junit.jupiter" % "junit-jupiter-params" % "5.7.0" % "test", + "com.github.tomakehurst" % "wiremock-jre8" % "2.27.2" % "test", + "org.hamcrest" % "hamcrest" % "2.2" % "test", + "commons-io" % "commons-io" % "2.8.0" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) ) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/model_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/model_test.mustache new file mode 100644 index 00000000000..0d75e120b09 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/model_test.mustache @@ -0,0 +1,48 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +import org.junit.jupiter.api.Test; + +{{#fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + +/** + * Model tests for {{classname}} + */ +class {{classname}}Test { + {{#models}} + {{#model}} + {{^vendorExtensions.x-is-one-of-interface}} + {{^isEnum}} + private final {{classname}} model = new {{classname}}(); + + {{/isEnum}} + /** + * Model tests for {{classname}} + */ + @Test + void test{{classname}}() { + // TODO: test {{classname}} + } + + {{#allVars}} + /** + * Test the property '{{name}}' + */ + @Test + void {{name}}Test() { + // TODO: test {{name}} + } + + {{/allVars}} + {{/vendorExtensions.x-is-one-of-interface}} + {{/model}} + {{/models}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache index ce830af9e11..65b3cc3c214 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache @@ -247,6 +247,11 @@ feign-form ${feign-form-version} + + io.github.openfeign + feign-okhttp + ${feign-version} + @@ -314,21 +319,39 @@ - junit - junit + ch.qos.logback + logback-classic + 1.2.3 + test + + + org.junit.jupiter + junit-jupiter ${junit-version} test - com.squareup.okhttp3 - mockwebserver - 3.6.0 + org.junit.jupiter + junit-jupiter-params + ${junit-version} test - org.assertj - assertj-core - 1.7.1 + org.hamcrest + hamcrest + 2.2 + test + + + com.github.tomakehurst + wiremock-jre8 + 2.27.2 + test + + + commons-io + commons-io + 2.8.0 test @@ -349,7 +372,7 @@ 2.9.10 {{/threetenbp}} 1.3.2 - 4.13.1 + 5.7.0 1.0.0 8.0.0 diff --git a/samples/client/petstore/java/feign-no-nullable/build.gradle b/samples/client/petstore/java/feign-no-nullable/build.gradle index 69082b38baf..f7c9d2b424e 100644 --- a/samples/client/petstore/java/feign-no-nullable/build.gradle +++ b/samples/client/petstore/java/feign-no-nullable/build.gradle @@ -94,6 +94,10 @@ if(hasProperty('target') && target == 'android') { } } +test { + useJUnitPlatform() +} + ext { swagger_annotations_version = "1.5.24" jackson_version = "2.10.3" @@ -101,7 +105,7 @@ ext { jackson_threetenbp_version = "2.9.10" feign_version = "10.11" feign_form_version = "3.8.0" - junit_version = "4.13.1" + junit_version = "5.7.0" scribejava_version = "8.0.0" } @@ -111,6 +115,7 @@ dependencies { implementation "io.github.openfeign:feign-core:$feign_version" implementation "io.github.openfeign:feign-jackson:$feign_version" implementation "io.github.openfeign:feign-slf4j:$feign_version" + implementation "io.github.openfeign:feign-okhttp:$feign_version" implementation "io.github.openfeign.form:feign-form:$feign_form_version" implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" @@ -120,5 +125,11 @@ dependencies { implementation "com.github.scribejava:scribejava-core:$scribejava_version" implementation "com.brsanthu:migbase64:2.2" implementation 'javax.annotation:javax.annotation-api:1.3.2' - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version" + testImplementation "com.github.tomakehurst:wiremock-jre8:2.27.2" + testImplementation "org.hamcrest:hamcrest:2.2" + testImplementation "commons-io:commons-io:2.8.0" + testImplementation "ch.qos.logback:logback-classic:1.2.3" } diff --git a/samples/client/petstore/java/feign-no-nullable/build.sbt b/samples/client/petstore/java/feign-no-nullable/build.sbt index 89fe08d2939..cdf3cd5db6b 100644 --- a/samples/client/petstore/java/feign-no-nullable/build.sbt +++ b/samples/client/petstore/java/feign-no-nullable/build.sbt @@ -10,10 +10,12 @@ lazy val root = (project in file(".")). resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( "io.swagger" % "swagger-annotations" % "1.5.24" % "compile", + "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", "io.github.openfeign" % "feign-core" % "10.11" % "compile", "io.github.openfeign" % "feign-jackson" % "10.11" % "compile", "io.github.openfeign" % "feign-slf4j" % "10.11" % "compile", "io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile", + "io.github.openfeign" % "feign-okhttp" % "10.11" % "compile", "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", @@ -22,7 +24,11 @@ lazy val root = (project in file(".")). "com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", - "junit" % "junit" % "4.13.1" % "test", + "org.junit.jupiter" % "junit-jupiter" % "5.7.0" % "test", + "org.junit.jupiter" % "junit-jupiter-params" % "5.7.0" % "test", + "com.github.tomakehurst" % "wiremock-jre8" % "2.27.2" % "test", + "org.hamcrest" % "hamcrest" % "2.2" % "test", + "commons-io" % "commons-io" % "2.8.0" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) ) diff --git a/samples/client/petstore/java/feign-no-nullable/pom.xml b/samples/client/petstore/java/feign-no-nullable/pom.xml index a0d99f21447..12816bcddff 100644 --- a/samples/client/petstore/java/feign-no-nullable/pom.xml +++ b/samples/client/petstore/java/feign-no-nullable/pom.xml @@ -240,6 +240,11 @@ feign-form ${feign-form-version} + + io.github.openfeign + feign-okhttp + ${feign-version} + @@ -276,21 +281,39 @@ - junit - junit + ch.qos.logback + logback-classic + 1.2.3 + test + + + org.junit.jupiter + junit-jupiter ${junit-version} test - com.squareup.okhttp3 - mockwebserver - 3.6.0 + org.junit.jupiter + junit-jupiter-params + ${junit-version} test - org.assertj - assertj-core - 1.7.1 + org.hamcrest + hamcrest + 2.2 + test + + + com.github.tomakehurst + wiremock-jre8 + 2.27.2 + test + + + commons-io + commons-io + 2.8.0 test @@ -306,7 +329,7 @@ 2.10.3 2.9.10 1.3.2 - 4.13.1 + 5.7.0 1.0.0 8.0.0 diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java index 87b9f7bbe27..8dd14bf1a27 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java @@ -6,6 +6,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.threeten.bp.*; +import feign.okhttp.OkHttpClient; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -36,6 +37,7 @@ public class ApiClient { objectMapper = createObjectMapper(); apiAuthorizations = new LinkedHashMap(); feignBuilder = Feign.builder() + .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) .decoder(new JacksonDecoder(objectMapper)) .logger(new Slf4jLogger()); diff --git a/samples/client/petstore/java/feign/build.gradle b/samples/client/petstore/java/feign/build.gradle index 637b0f9d649..394cdda63a9 100644 --- a/samples/client/petstore/java/feign/build.gradle +++ b/samples/client/petstore/java/feign/build.gradle @@ -94,6 +94,10 @@ if(hasProperty('target') && target == 'android') { } } +test { + useJUnitPlatform() +} + ext { swagger_annotations_version = "1.5.24" jackson_version = "2.10.3" @@ -102,7 +106,7 @@ ext { jackson_threetenbp_version = "2.9.10" feign_version = "10.11" feign_form_version = "3.8.0" - junit_version = "4.13.1" + junit_version = "5.7.0" scribejava_version = "8.0.0" } @@ -112,6 +116,7 @@ dependencies { implementation "io.github.openfeign:feign-core:$feign_version" implementation "io.github.openfeign:feign-jackson:$feign_version" implementation "io.github.openfeign:feign-slf4j:$feign_version" + implementation "io.github.openfeign:feign-okhttp:$feign_version" implementation "io.github.openfeign.form:feign-form:$feign_form_version" implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" @@ -122,5 +127,11 @@ dependencies { implementation "com.github.scribejava:scribejava-core:$scribejava_version" implementation "com.brsanthu:migbase64:2.2" implementation 'javax.annotation:javax.annotation-api:1.3.2' - testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version" + testImplementation "com.github.tomakehurst:wiremock-jre8:2.27.2" + testImplementation "org.hamcrest:hamcrest:2.2" + testImplementation "commons-io:commons-io:2.8.0" + testImplementation "ch.qos.logback:logback-classic:1.2.3" } diff --git a/samples/client/petstore/java/feign/build.sbt b/samples/client/petstore/java/feign/build.sbt index a2783502176..5f999c727fe 100644 --- a/samples/client/petstore/java/feign/build.sbt +++ b/samples/client/petstore/java/feign/build.sbt @@ -10,10 +10,12 @@ lazy val root = (project in file(".")). resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( "io.swagger" % "swagger-annotations" % "1.5.24" % "compile", + "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", "io.github.openfeign" % "feign-core" % "10.11" % "compile", "io.github.openfeign" % "feign-jackson" % "10.11" % "compile", "io.github.openfeign" % "feign-slf4j" % "10.11" % "compile", "io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile", + "io.github.openfeign" % "feign-okhttp" % "10.11" % "compile", "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", @@ -22,7 +24,11 @@ lazy val root = (project in file(".")). "com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", - "junit" % "junit" % "4.13.1" % "test", + "org.junit.jupiter" % "junit-jupiter" % "5.7.0" % "test", + "org.junit.jupiter" % "junit-jupiter-params" % "5.7.0" % "test", + "com.github.tomakehurst" % "wiremock-jre8" % "2.27.2" % "test", + "org.hamcrest" % "hamcrest" % "2.2" % "test", + "commons-io" % "commons-io" % "2.8.0" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) ) diff --git a/samples/client/petstore/java/feign/pom.xml b/samples/client/petstore/java/feign/pom.xml index b3b36a2077a..a963eaf0d20 100644 --- a/samples/client/petstore/java/feign/pom.xml +++ b/samples/client/petstore/java/feign/pom.xml @@ -240,6 +240,11 @@ feign-form ${feign-form-version} + + io.github.openfeign + feign-okhttp + ${feign-version} + @@ -281,21 +286,39 @@ - junit - junit + ch.qos.logback + logback-classic + 1.2.3 + test + + + org.junit.jupiter + junit-jupiter ${junit-version} test - com.squareup.okhttp3 - mockwebserver - 3.6.0 + org.junit.jupiter + junit-jupiter-params + ${junit-version} test - org.assertj - assertj-core - 1.7.1 + org.hamcrest + hamcrest + 2.2 + test + + + com.github.tomakehurst + wiremock-jre8 + 2.27.2 + test + + + commons-io + commons-io + 2.8.0 test @@ -312,7 +335,7 @@ 2.10.3 2.9.10 1.3.2 - 4.13.1 + 5.7.0 1.0.0 8.0.0 diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java index 87d97bddee8..118b665aeaf 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java @@ -6,6 +6,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.threeten.bp.*; +import feign.okhttp.OkHttpClient; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -37,6 +38,7 @@ public class ApiClient { objectMapper = createObjectMapper(); apiAuthorizations = new LinkedHashMap(); feignBuilder = Feign.builder() + .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) .decoder(new JacksonDecoder(objectMapper)) .logger(new Slf4jLogger()); diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java index b5e26401d2f..b1a286dfc90 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -1,24 +1,19 @@ package org.openapitools.client.api; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openapitools.client.ApiClient; import org.openapitools.client.model.Client; -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; /** * API tests for AnotherFakeApi */ -public class AnotherFakeApiTest { +class AnotherFakeApiTest { private AnotherFakeApi api; - @Before - public void setup() { + @BeforeEach + void setup() { api = new ApiClient().buildClient(AnotherFakeApi.class); } @@ -29,7 +24,7 @@ public class AnotherFakeApiTest { * To test special tags and operation ID starting with number */ @Test - public void call123testSpecialTagsTest() { + void call123testSpecialTagsTest() { Client body = null; // Client response = api.call123testSpecialTags(body); diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/FakeApiTest.java index 52f9af36b6e..d165a66b64a 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/FakeApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -1,342 +1,321 @@ package org.openapitools.client.api; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.common.Slf4jNotifier; +import feign.FeignException; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.openapitools.client.ApiClient; -import java.math.BigDecimal; import org.openapitools.client.model.Client; -import java.io.File; -import org.openapitools.client.model.FileSchemaTestClass; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.OuterComposite; import org.openapitools.client.model.User; import org.openapitools.client.model.XmlItem; -import org.junit.Before; -import org.junit.Test; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; -import java.util.ArrayList; +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; -import java.util.Map; -/** - * API tests for FakeApi - */ -public class FakeApiTest { +import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; - private FakeApi api; +class FakeApiTest { - @Before - public void setup() { - api = new ApiClient().buildClient(FakeApi.class); - } + private static WireMockServer wm = new WireMockServer(options().dynamicPort().notifier(new Slf4jNotifier(true))); - - /** - * creates an XmlItem - * - * this route creates an XmlItem - */ - @Test - public void createXmlItemTest() { - XmlItem xmlItem = null; - // api.createXmlItem(xmlItem); + private FakeApi api; - // TODO: test validations - } + @BeforeAll + static void startWireMock() { + wm.start(); + } - - /** - * - * - * Test serialization of outer boolean types - */ - @Test - public void fakeOuterBooleanSerializeTest() { - Boolean body = null; - // Boolean response = api.fakeOuterBooleanSerialize(body); + @AfterAll + static void stopWireMock() { + wm.shutdown(); + } - // TODO: test validations - } + @BeforeEach + void setUp() { + ApiClient apiClient = new ApiClient(); + apiClient.setBasePath(wm.baseUrl()); + api = apiClient.buildClient(FakeApi.class); + } - - /** - * - * - * Test serialization of object with outer number type - */ - @Test - public void fakeOuterCompositeSerializeTest() { - OuterComposite body = null; - // OuterComposite response = api.fakeOuterCompositeSerialize(body); + @Test + void createXmlItem() { + wm.stubFor(post(urlEqualTo("/fake/create_xml_item")) + .withHeader("Content-Type", equalTo("application/xml")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(ok())); - // TODO: test validations - } + XmlItem xmlItem = new XmlItem(); + api.createXmlItem(xmlItem); + } - - /** - * - * - * Test serialization of outer number types - */ - @Test - public void fakeOuterNumberSerializeTest() { - BigDecimal body = null; - // BigDecimal response = api.fakeOuterNumberSerialize(body); + @ParameterizedTest + @ValueSource(strings = {"true", "false"}) + void fakeOuterBooleanSerialize(String returnBoolean) { + wm.stubFor(post(urlEqualTo("/fake/outer/boolean")) + .withHeader("Content-Type", equalTo("*/*")) + .withHeader("Accept", equalTo("*/*")) + .willReturn(ok(returnBoolean))); - // TODO: test validations - } + boolean expectedBoolean = Boolean.parseBoolean(returnBoolean); + Boolean aBoolean = api.fakeOuterBooleanSerialize(expectedBoolean); - - /** - * - * - * Test serialization of outer string types - */ - @Test - public void fakeOuterStringSerializeTest() { - String body = null; - // String response = api.fakeOuterStringSerialize(body); + assertThat(aBoolean, is(expectedBoolean)); + } - // TODO: test validations - } + @Test + void fakeOuterCompositeSerialize() { + String body = "{\n" + + " \"my_number\": 123.45,\n" + + " \"my_string\":\"Hello\",\n" + + " \"my_boolean\": true\n" + + "}"; + wm.stubFor(post(urlEqualTo("/fake/outer/composite")) + .withHeader("Content-Type", equalTo("*/*")) + .withHeader("Accept", equalTo("*/*")) + .withRequestBody(equalToJson(body, true, false)) + .willReturn(ok(body))); - - /** - * - * - * For this test, the body for this request much reference a schema named `File`. - */ - @Test - public void testBodyWithFileSchemaTest() { - FileSchemaTestClass body = null; - // api.testBodyWithFileSchema(body); + OuterComposite outerComposite = new OuterComposite(); + outerComposite.setMyBoolean(Boolean.TRUE); + outerComposite.setMyNumber(BigDecimal.valueOf(123.45)); + outerComposite.setMyString("Hello"); - // TODO: test validations - } + OuterComposite result = api.fakeOuterCompositeSerialize(outerComposite); - - /** - * - * - * - */ - @Test - public void testBodyWithQueryParamsTest() { - String query = null; - User body = null; - // api.testBodyWithQueryParams(query, body); + assertThat(result, is(outerComposite)); + } - // TODO: test validations - } + @Test + void fakeOuterNumberSerialize() { + String body = "123.45"; + wm.stubFor(post(urlEqualTo("/fake/outer/number")) + .withHeader("Content-Type", equalTo("*/*")) + .withHeader("Accept", equalTo("*/*")) + .withRequestBody(equalTo(body)) + .willReturn(ok(body))); - /** - * - * - * - * - * This tests the overload of the method that uses a Map for query parameters instead of - * listing them out individually. - */ - @Test - public void testBodyWithQueryParamsTestQueryMap() { - User body = null; - FakeApi.TestBodyWithQueryParamsQueryParams queryParams = new FakeApi.TestBodyWithQueryParamsQueryParams() - .query(null); - // api.testBodyWithQueryParams(body, queryParams); + BigDecimal result = api.fakeOuterNumberSerialize(BigDecimal.valueOf(123.45)); - // TODO: test validations - } - - /** - * To test \"client\" model - * - * To test \"client\" model - */ - @Test - public void testClientModelTest() { - Client body = null; - // Client response = api.testClientModel(body); + assertThat(result, is(result)); + } - // TODO: test validations - } + @Test + void fakeOuterStringSerialize() { + String body = "Hello world"; + wm.stubFor(post(urlEqualTo("/fake/outer/string")) + .withHeader("Content-Type", equalTo("*/*")) + .withHeader("Accept", equalTo("*/*")) + .withRequestBody(equalTo("\"" + body + "\"")) + .willReturn(ok("\"" + body + "\""))); - - /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - */ - @Test - public void testEndpointParametersTest() { - BigDecimal number = null; - Double _double = null; - String patternWithoutDelimiter = null; - byte[] _byte = null; - Integer integer = null; - Integer int32 = null; - Long int64 = null; - Float _float = null; - String string = null; - File binary = null; - LocalDate date = null; - OffsetDateTime dateTime = null; - String password = null; - String paramCallback = null; - // api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + String result = api.fakeOuterStringSerialize(body); - // TODO: test validations - } + assertThat(result, is(body)); + } - - /** - * To test enum parameters - * - * To test enum parameters - */ - @Test - public void testEnumParametersTest() { - List enumHeaderStringArray = null; - String enumHeaderString = null; - List enumQueryStringArray = null; - String enumQueryString = null; - Integer enumQueryInteger = null; - Double enumQueryDouble = null; - List enumFormStringArray = null; - String enumFormString = null; - // api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + @Test + void testBodyWithFileSchema() throws IOException { + //TODO + } - // TODO: test validations - } + @Test + void testBodyWithQueryParams() { + String body = "{\n" + + " \"id\":123456,\n" + + " \"username\":null,\n" + + " \"firstName\":\"Bruce\",\n" + + " \"lastName\":\"Wayne\",\n" + + " \"email\":\"mail@email.com\",\n" + + " \"password\":\"password\",\n" + + " \"phone\":\"+123 3313131\",\n" + + " \"userStatus\":1\n" + + "}"; - /** - * To test enum parameters - * - * To test enum parameters - * - * This tests the overload of the method that uses a Map for query parameters instead of - * listing them out individually. - */ - @Test - public void testEnumParametersTestQueryMap() { - List enumHeaderStringArray = null; - String enumHeaderString = null; - List enumFormStringArray = null; - String enumFormString = null; - FakeApi.TestEnumParametersQueryParams queryParams = new FakeApi.TestEnumParametersQueryParams() - .enumQueryStringArray(null) - .enumQueryString(null) - .enumQueryInteger(null) - .enumQueryDouble(null); - // api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumFormStringArray, enumFormString, queryParams); + wm.stubFor(put(urlEqualTo("/fake/body-with-query-params?query=tags")) + .withHeader("Content-Type", equalTo("application/json")) + .withHeader("Accept", equalTo("application/json")) + .withRequestBody(equalToJson(body)) + .willReturn(ok())); - // TODO: test validations - } - - /** - * Fake endpoint to test group parameters (optional) - * - * Fake endpoint to test group parameters (optional) - */ - @Test - public void testGroupParametersTest() { - Integer requiredStringGroup = null; - Boolean requiredBooleanGroup = null; - Long requiredInt64Group = null; - Integer stringGroup = null; - Boolean booleanGroup = null; - Long int64Group = null; - // api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + User user = new User(); + user.setEmail("mail@email.com"); + user.setFirstName("Bruce"); + user.setLastName("Wayne"); + user.setId(123456L); + user.setUserStatus(1); + user.setPassword("password"); + user.setPhone("+123 3313131"); - // TODO: test validations - } + api.testBodyWithQueryParams("tags", user); + } - /** - * Fake endpoint to test group parameters (optional) - * - * Fake endpoint to test group parameters (optional) - * - * This tests the overload of the method that uses a Map for query parameters instead of - * listing them out individually. - */ - @Test - public void testGroupParametersTestQueryMap() { - Boolean requiredBooleanGroup = null; - Boolean booleanGroup = null; - FakeApi.TestGroupParametersQueryParams queryParams = new FakeApi.TestGroupParametersQueryParams() - .requiredStringGroup(null) - .requiredInt64Group(null) - .stringGroup(null) - .int64Group(null); - // api.testGroupParameters(requiredBooleanGroup, booleanGroup, queryParams); + @Test + void testBodyWithQueryParamsMap() { + String body = "{\n" + + " \"id\":123456,\n" + + " \"username\":null,\n" + + " \"firstName\":\"Bruce\",\n" + + " \"lastName\":\"Wayne\",\n" + + " \"email\":\"mail@email.com\",\n" + + " \"password\":\"password\",\n" + + " \"phone\":\"+123 3313131\",\n" + + " \"userStatus\":1\n" + + "}"; - // TODO: test validations - } - - /** - * test inline additionalProperties - * - * - */ - @Test - public void testInlineAdditionalPropertiesTest() { - Map param = null; - // api.testInlineAdditionalProperties(param); + wm.stubFor(put(urlEqualTo("/fake/body-with-query-params?query=value1")) + .withHeader("Content-Type", equalTo("application/json")) + .withHeader("Accept", equalTo("application/json")) + .withRequestBody(equalToJson(body)) + .willReturn(ok())); - // TODO: test validations - } + User user = new User(); + user.setEmail("mail@email.com"); + user.setFirstName("Bruce"); + user.setLastName("Wayne"); + user.setId(123456L); + user.setUserStatus(1); + user.setPassword("password"); + user.setPhone("+123 3313131"); - - /** - * test json serialization of form data - * - * - */ - @Test - public void testJsonFormDataTest() { - String param = null; - String param2 = null; - // api.testJsonFormData(param, param2); + FakeApi.TestBodyWithQueryParamsQueryParams queryParams = new FakeApi.TestBodyWithQueryParamsQueryParams(); + queryParams.query("value1"); - // TODO: test validations - } + api.testBodyWithQueryParams(user, queryParams); + } - - /** - * - * - * To test the collection format in query parameters - */ - @Test - public void testQueryParameterCollectionFormatTest() { - List pipe = null; - List ioutil = null; - List http = null; - List url = null; - List context = null; - // api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + @Test + void testClientModel() { + String body = "{\n" + + " \"client\":\"Mr Wayne\"\n" + + "}"; - // TODO: test validations - } + wm.stubFor(patch(urlEqualTo("/fake")) + .withHeader("Content-Type", equalTo("application/json")) + .withHeader("Accept", equalTo("application/json")) + .withRequestBody(equalToJson(body)) + .willReturn(ok(body))); - /** - * - * - * To test the collection format in query parameters - * - * This tests the overload of the method that uses a Map for query parameters instead of - * listing them out individually. - */ - @Test - public void testQueryParameterCollectionFormatTestQueryMap() { - FakeApi.TestQueryParameterCollectionFormatQueryParams queryParams = new FakeApi.TestQueryParameterCollectionFormatQueryParams() - .pipe(null) - .ioutil(null) - .http(null) - .url(null) - .context(null); - // api.testQueryParameterCollectionFormat(queryParams); + Client client = new Client(); + client.setClient("Mr Wayne"); - // TODO: test validations - } - -} + Client result = api.testClientModel(client); + + assertThat(result.getClient(), is("Mr Wayne")); + } + + @Test + void testEndpointParameters() throws IOException { + wm.stubFor(post(urlEqualTo("/fake")) + .withHeader("Content-Type", containing("application/x-www-form-urlencoded")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(ok())); + + //TODO Cannot serialize bytearray to x-www-form-urlencoded, must use multipart + api.testEndpointParameters(BigDecimal.ONE, 1.0, "abc", null, 123, + 1234, 123L, 1.0f, "string", File.createTempFile("testEndpointParameters", "tmp"), LocalDate.now(), OffsetDateTime.now(), + "password", "callback"); + } + + @Test + void testEnumParameters() { + //TODO GET method does not allow request body + } + + @Test + void testGroupParameters() { + wm.stubFor(delete(urlEqualTo("/fake?required_string_group=123&required_int64_group=123&string_group=123&int64_group=123")) + .withHeader("Accept", equalTo("application/json")) + .withHeader("required_boolean_group", equalTo("true")) + .withHeader("boolean_group", equalTo("true")) + .willReturn(ok())); + + api.testGroupParameters(123, true, 123L, 123, true, 123L); + } + + @Test + void testInlineAdditionalProperties() { + + wm.stubFor(post(urlEqualTo("/fake/inline-additionalProperties")) + .withHeader("Content-Type", equalTo("application/json")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(ok())); + + api.testInlineAdditionalProperties(new HashMap<>()); + + } + + @Test + void testQueryParameterCollectionFormat() { + + wm.stubFor(put(urlEqualTo("/fake/test-query-paramters?pipe=pipe1&pipe=pipe2&ioutil=io&http=http&url=url&context=context")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(ok())); + + api.testQueryParameterCollectionFormat(Arrays.asList("pipe1", "pipe2"), Arrays.asList("io"), Arrays.asList("http"), Arrays.asList("url"), Arrays.asList("context")); + } + + @Test + void testQueryParameterCollectionFormatQueryParams() { + + wm.stubFor(put(urlEqualTo("/fake/test-query-paramters?ioutil=io&context=context&http=http&pipe=pipe1&pipe=pipe2&url=url")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(ok())); + + HashMap params = new HashMap<>(); + params.put("context", Arrays.asList("context")); + params.put("pipe", Arrays.asList("pipe1", "pipe2")); + params.put("ioutil", Arrays.asList("io")); + params.put("http", Arrays.asList("http")); + params.put("url", Arrays.asList("url")); + + api.testQueryParameterCollectionFormat(params); + } + + @Test + void test404() { + wm.stubFor(post(urlEqualTo("/fake/create_xml_item")) + .withHeader("Content-Type", equalTo("application/xml")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(notFound())); + + XmlItem xmlItem = new XmlItem(); + assertThrows(FeignException.NotFound.class, () -> api.createXmlItem(xmlItem)); + } + + @Test + void test500() { + wm.stubFor(post(urlEqualTo("/fake/create_xml_item")) + .withHeader("Content-Type", equalTo("application/xml")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(serverError())); + + XmlItem xmlItem = new XmlItem(); + assertThrows(FeignException.InternalServerError.class, () -> api.createXmlItem(xmlItem)); + } + + @Test + void test400() { + wm.stubFor(post(urlEqualTo("/fake/create_xml_item")) + .withHeader("Content-Type", equalTo("application/xml")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(badRequest())); + + XmlItem xmlItem = new XmlItem(); + assertThrows(FeignException.BadRequest.class, () -> api.createXmlItem(xmlItem)); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java index badb867ce81..382c6760fba 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -1,40 +1,66 @@ package org.openapitools.client.api; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.common.Slf4jNotifier; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openapitools.client.ApiClient; import org.openapitools.client.model.Client; -import org.junit.Before; -import org.junit.Test; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; /** * API tests for FakeClassnameTags123Api */ -public class FakeClassnameTags123ApiTest { +class FakeClassnameTags123ApiTest { - private FakeClassnameTags123Api api; + private static WireMockServer wm = new WireMockServer(options().dynamicPort().notifier(new Slf4jNotifier(true))); - @Before - public void setup() { - api = new ApiClient().buildClient(FakeClassnameTags123Api.class); - } + private FakeClassnameTags123Api api; - - /** - * To test class name in snake case - * - * To test class name in snake case - */ - @Test - public void testClassnameTest() { - Client body = null; - // Client response = api.testClassname(body); + @BeforeAll + static void startWireMock() { + wm.start(); + } + + @AfterAll + static void stopWireMock() { + wm.shutdown(); + } + + @BeforeEach + void setUp() { + ApiClient apiClient = new ApiClient(); + apiClient.setBasePath(wm.baseUrl()); + api = apiClient.buildClient(FakeClassnameTags123Api.class); + } + + /** + * To test class name in snake case + *

+ * To test class name in snake case + */ + @Test + void testClassnameTest() { + String responseBody = "{\n" + + " \"client\":\"Bruce\"\n" + + "}"; + wm.stubFor(patch(urlEqualTo("/fake_classname_test")) + .withHeader("Content-Type", equalTo("application/json")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(ok(responseBody))); + + Client client = new Client(); + client.setClient("Bruce"); + + Client response = api.testClassname(client); + assertThat(response, is(client)); + } - // TODO: test validations - } - } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/PetApiTest.java index d49eb6ea026..80de2d5749b 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/PetApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -1,194 +1,210 @@ package org.openapitools.client.api; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.matching.MultipartValuePatternBuilder; +import com.google.common.collect.Sets; +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.openapitools.client.ApiClient; -import java.io.File; -import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; -import java.util.Set; -import org.junit.Before; -import org.junit.Test; -import java.util.ArrayList; -import java.util.HashMap; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Arrays; import java.util.List; -import java.util.Map; +import java.util.Set; + +import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; /** - * API tests for PetApi + * API tests for PetAp */ -public class PetApiTest { +class PetApiTest { - private PetApi api; + private static PetApi api; - @Before - public void setup() { - api = new ApiClient().buildClient(PetApi.class); - } + private static WireMockServer wm = new WireMockServer(options().dynamicPort()); + private static String petJson; + private static String petListJson; - - /** - * Add a new pet to the store - * - * - */ - @Test - public void addPetTest() { - Pet body = null; - // api.addPet(body); + private ObjectMapper objectMapper = new ObjectMapper(); - // TODO: test validations - } + @BeforeAll + static void setup() throws IOException { + wm.start(); - - /** - * Deletes a pet - * - * - */ - @Test - public void deletePetTest() { - Long petId = null; - String apiKey = null; - // api.deletePet(petId, apiKey); + ApiClient apiClient = new ApiClient(); + apiClient.setBasePath(wm.baseUrl()); + api = apiClient.buildClient(PetApi.class); - // TODO: test validations - } + petJson = IOUtils.toString(PetApiTest.class.getResourceAsStream("/pet.json"), "UTF-8"); + petListJson = IOUtils.toString(PetApiTest.class.getResourceAsStream("/pet_list.json"), "UTF-8"); + } - - /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - */ - @Test - public void findPetsByStatusTest() { - List status = null; - // List response = api.findPetsByStatus(status); + @AfterAll + static void shutdown() { + wm.shutdown(); + } - // TODO: test validations - } + @Test + void addPet() throws JsonProcessingException { + wm.stubFor(post(urlEqualTo("/pet")) + .willReturn(aResponse().withBody(petJson))); - /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - * - * This tests the overload of the method that uses a Map for query parameters instead of - * listing them out individually. - */ - @Test - public void findPetsByStatusTestQueryMap() { - PetApi.FindPetsByStatusQueryParams queryParams = new PetApi.FindPetsByStatusQueryParams() - .status(null); - // List response = api.findPetsByStatus(queryParams); + Pet pet = objectMapper.readValue(petJson, Pet.class); - // TODO: test validations - } - - /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - */ - @Test - public void findPetsByTagsTest() { - Set tags = null; - // Set response = api.findPetsByTags(tags); + api.addPet(pet); - // TODO: test validations - } + wm.verify(postRequestedFor(urlEqualTo("/pet")) + .withHeader("Content-Type", equalTo("application/json")) + .withHeader("Accept", equalTo("application/json")) + .withRequestBody(equalToJson(petJson))); + } - /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * This tests the overload of the method that uses a Map for query parameters instead of - * listing them out individually. - */ - @Test - public void findPetsByTagsTestQueryMap() { - PetApi.FindPetsByTagsQueryParams queryParams = new PetApi.FindPetsByTagsQueryParams() - .tags(null); - // Set response = api.findPetsByTags(queryParams); + @Test + void deletedPet() { + wm.stubFor(delete(urlEqualTo("/pet/85")) + .willReturn(aResponse())); - // TODO: test validations - } - - /** - * Find pet by ID - * - * Returns a single pet - */ - @Test - public void getPetByIdTest() { - Long petId = null; - // Pet response = api.getPetById(petId); + api.deletePet(85L, "API_KEY"); - // TODO: test validations - } + wm.verify(deleteRequestedFor(urlEqualTo("/pet/85")) + .withHeader("api_key", equalTo("API_KEY")) + .withHeader("Accept", equalTo("application/json"))); + } - - /** - * Update an existing pet - * - * - */ - @Test - public void updatePetTest() { - Pet body = null; - // api.updatePet(body); + @Test + void findPetsByStatus() { + wm.stubFor(get(urlEqualTo("/pet/findByStatus?status=available&status=sold")) + .willReturn(aResponse() + .withHeader("Content-Type", "application/json") + .withBody(petListJson))); - // TODO: test validations - } + List petList = api.findPetsByStatus(Arrays.asList("available", "sold")); + assertThat(petList.size(), is(2)); - - /** - * Updates a pet in the store with form data - * - * - */ - @Test - public void updatePetWithFormTest() { - Long petId = null; - String name = null; - String status = null; - // api.updatePetWithForm(petId, name, status); + validatePet1(petList.get(0)); + validatePet2(petList.get(1)); + } - // TODO: test validations - } + @Test + void findPetsByStatusQueryMap() { + wm.stubFor(get(urlEqualTo("/pet/findByStatus?status=available,sold")) + .willReturn(aResponse() + .withHeader("Content-Type", "application/json") + .withBody(petListJson))); - - /** - * uploads an image - * - * - */ - @Test - public void uploadFileTest() { - Long petId = null; - String additionalMetadata = null; - File file = null; - // ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + PetApi.FindPetsByStatusQueryParams findPetsByStatusQueryParams = new PetApi.FindPetsByStatusQueryParams(); + findPetsByStatusQueryParams.status(Arrays.asList("available", "sold")); - // TODO: test validations - } + List petList = api.findPetsByStatus(findPetsByStatusQueryParams); + assertThat(petList.size(), is(2)); - - /** - * uploads an image (required) - * - * - */ - @Test - public void uploadFileWithRequiredFileTest() { - Long petId = null; - File requiredFile = null; - String additionalMetadata = null; - // ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + validatePet1(petList.get(0)); + validatePet2(petList.get(1)); + } - // TODO: test validations - } + @Test + void findPetsByTags() { + wm.stubFor(get(urlEqualTo("/pet/findByTags?tags=tag1&tags=tag2")) + .willReturn(aResponse() + .withHeader("Content-Type", "application/json") + .withBody(petListJson))); - + Set petList = api.findPetsByTags(Sets.newHashSet("tag1", "tag2")); + assertThat(petList.size(), is(2)); + } + + @Test + void getPetById() { + wm.stubFor(get(urlEqualTo("/pet/85")) + .willReturn(aResponse() + .withHeader("Content-Type", "application/json") + .withBody(petJson))); + + Pet pet = api.getPetById(85L); + + validatePet1(pet); + } + + @Test + void updatePet() throws JsonProcessingException { + wm.stubFor(put(urlEqualTo("/pet")) + .willReturn(aResponse() + .withHeader("Content-Type", "application/json") + .withBody(petJson))); + + Pet pet = objectMapper.readValue(petJson, Pet.class); + api.updatePet(pet); + + wm.verify(putRequestedFor(urlEqualTo("/pet")) + .withHeader("Accept", equalTo("application/json")) + .withHeader("Content-Type", equalTo("application/json")) + .withRequestBody(equalToJson(petJson))); + } + + @Test + void updatePetWithForm() { + wm.stubFor(post(anyUrl()).willReturn(aResponse())); + + api.updatePetWithForm(85L, "Rex", "sold"); + + wm.verify(postRequestedFor(urlEqualTo("/pet/85")) + .withHeader("Accept", equalTo("application/json")) + .withHeader("Content-Type", containing("application/x-www-form-urlencoded")) + .withRequestBody(containing("name=Rex")) + .withRequestBody(containing("status=sold"))); + } + + @Test + void uploadFile() throws IOException { + wm.stubFor(post("/pet/85/uploadImage").willReturn(aResponse())); + File file = File.createTempFile("test", ".tmp"); + IOUtils.write("ABCD".getBytes(), new FileOutputStream(file)); + + api.uploadFile(85L, "metadata", file); + + wm.verify(postRequestedFor(urlEqualTo("/pet/85/uploadImage")) + .withHeader("Content-Type", containing("multipart/form-data")) + .withHeader("Accept", containing("application/json")) + .withRequestBodyPart(new MultipartValuePatternBuilder() + .withName("additionalMetadata").build()) + .withRequestBodyPart(new MultipartValuePatternBuilder() + .withName("file").withBody(binaryEqualTo("ABCD".getBytes())).build()) + ); + } + + private void validatePet1(Pet pet) { + assertThat(pet.getId(), is(85L)); + assertThat(pet.getCategory().getName(), is("Dogs")); + assertThat(pet.getCategory().getId(), is(1L)); + assertThat(pet.getName(), is("LvRcat")); + assertThat(pet.getPhotoUrls().size(), is(1)); + assertThat(pet.getPhotoUrls().stream().findAny().get(), is("string")); + assertThat(pet.getTags().size(), is(1)); + assertThat(pet.getTags().get(0).getId(), is(10L)); + assertThat(pet.getTags().get(0).getName(), is("tag")); + assertThat(pet.getStatus(), is(Pet.StatusEnum.AVAILABLE)); + } + + private void validatePet2(Pet pet) { + assertThat(pet.getId(), is(42L)); + assertThat(pet.getCategory().getName(), is("Dogs")); + assertThat(pet.getCategory().getId(), is(1L)); + assertThat(pet.getName(), is("Louise")); + assertThat(pet.getPhotoUrls().size(), is(1)); + assertThat(pet.getPhotoUrls().stream().findAny().get(), is("photo")); + assertThat(pet.getTags().size(), is(1)); + assertThat(pet.getTags().get(0).getId(), is(0L)); + assertThat(pet.getTags().get(0).getName(), is("obedient")); + assertThat(pet.getStatus(), is(Pet.StatusEnum.SOLD)); + } } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/StoreApiTest.java index 07a48ec6e63..2b0ac4c9d34 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/StoreApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -1,81 +1,153 @@ package org.openapitools.client.api; +import com.github.tomakehurst.wiremock.WireMockServer; +import feign.FeignException; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.openapitools.client.ApiClient; import org.openapitools.client.model.Order; -import org.junit.Before; -import org.junit.Test; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.ZoneOffset; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; import java.util.Map; +import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + /** * API tests for StoreApi */ public class StoreApiTest { - private StoreApi api; + private static StoreApi api; - @Before - public void setup() { - api = new ApiClient().buildClient(StoreApi.class); - } + private static WireMockServer wm = new WireMockServer(options().dynamicPort()); - - /** - * Delete purchase order by ID - * - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - */ - @Test - public void deleteOrderTest() { - String orderId = null; - // api.deleteOrder(orderId); + @BeforeAll + static void setup() { + wm.start(); - // TODO: test validations - } + ApiClient apiClient = new ApiClient(); + apiClient.setBasePath(wm.baseUrl()); + api = apiClient.buildClient(StoreApi.class); - - /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - */ - @Test - public void getInventoryTest() { - // Map response = api.getInventory(); + } - // TODO: test validations - } + @AfterAll + static void shutdown() { + wm.shutdown(); + } - - /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - */ - @Test - public void getOrderByIdTest() { - Long orderId = null; - // Order response = api.getOrderById(orderId); - // TODO: test validations - } + /** + * Delete purchase order by ID + *

+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + */ + @Test + void deleteOrderTest() { + wm.stubFor(delete(urlEqualTo("/store/order/1234")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(ok())); - - /** - * Place an order for a pet - * - * - */ - @Test - public void placeOrderTest() { - Order body = null; - // Order response = api.placeOrder(body); + api.deleteOrder("1234"); + } - // TODO: test validations - } + @Test + void deleteOrderTestInvalid() { + wm.stubFor(delete(urlEqualTo("/store/order/abc")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(aResponse().withStatus(400))); + + assertThrows(FeignException.BadRequest.class, () -> api.deleteOrder("abc")); + } + + /** + * Returns pet inventories by status + *

+ * Returns a map of status codes to quantities + */ + @Test + void getInventoryTest() { + wm.stubFor(get(urlEqualTo("/store/inventory")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(ok("{\n" + + " \"prop1\": 1,\n" + + " \"prop2\": 2\n" + + "}"))); + + Map inventory = api.getInventory(); + + assertThat(inventory.keySet().size(), is(2)); + assertThat(inventory.get("prop1"), is(1)); + assertThat(inventory.get("prop2"), is(2)); + } + + + /** + * Find purchase order by ID + *

+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + */ + @Test + void getOrderByIdTest() { + String responseBody = "{\n" + + " \"id\": 1,\n" + + " \"petId\": 1,\n" + + " \"quantity\": 10,\n" + + " \"shipDate\": \"2120-03-23T01:23:44.000000009+0000\",\n" + + " \"status\": \"placed\",\n" + + " \"complete\": true\n" + + "}"; + + wm.stubFor(get(urlEqualTo("/store/order/123")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(ok(responseBody))); + + Order order = api.getOrderById(123L); + + assertThat(order.getId(), is(1L)); + assertThat(order.getPetId(), is(1L)); + assertThat(order.getQuantity(), is(10)); + assertThat(order.getShipDate(), is(OffsetDateTime.of(2120, 03, 23, 01, 23, 44, 9, ZoneOffset.UTC))); + assertThat(order.getStatus(), is(Order.StatusEnum.PLACED)); + assertThat(order.isComplete(), is(true)); + } + + + /** + * Place an order for a pet + */ + @Test + void placeOrderTest() { + String responseBody = "{\n" + + " \"id\": 1,\n" + + " \"petId\": 1,\n" + + " \"quantity\": 10,\n" + + " \"shipDate\": \"2120-03-23T01:23:44.000000009+0000\",\n" + + " \"status\": \"placed\",\n" + + " \"complete\": true\n" + + "}"; + + Order newOrder = new Order(); + newOrder.setId(1L); + newOrder.setPetId(1L); + newOrder.setQuantity(10); + newOrder.shipDate(OffsetDateTime.of(2120, 03, 23, 01, 23, 44, 9, ZoneOffset.UTC)); + newOrder.setStatus(Order.StatusEnum.PLACED); + newOrder.setComplete(Boolean.TRUE); + + wm.stubFor(post(urlEqualTo("/store/order")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(ok(responseBody))); + + Order order = api.placeOrder(newOrder); + + assertThat(order, is(newOrder)); + } - } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/UserApiTest.java index 2656fb4cc92..05914a1bc2a 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/UserApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -1,24 +1,21 @@ package org.openapitools.client.api; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openapitools.client.ApiClient; import org.openapitools.client.model.User; -import org.junit.Before; -import org.junit.Test; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * API tests for UserApi */ -public class UserApiTest { +class UserApiTest { private UserApi api; - @Before - public void setup() { + @BeforeEach + void setup() { api = new ApiClient().buildClient(UserApi.class); } @@ -29,7 +26,7 @@ public class UserApiTest { * This can only be done by the logged in user. */ @Test - public void createUserTest() { + void createUserTest() { User body = null; // api.createUser(body); @@ -43,7 +40,7 @@ public class UserApiTest { * */ @Test - public void createUsersWithArrayInputTest() { + void createUsersWithArrayInputTest() { List body = null; // api.createUsersWithArrayInput(body); @@ -57,7 +54,7 @@ public class UserApiTest { * */ @Test - public void createUsersWithListInputTest() { + void createUsersWithListInputTest() { List body = null; // api.createUsersWithListInput(body); @@ -71,7 +68,7 @@ public class UserApiTest { * This can only be done by the logged in user. */ @Test - public void deleteUserTest() { + void deleteUserTest() { String username = null; // api.deleteUser(username); @@ -85,7 +82,7 @@ public class UserApiTest { * */ @Test - public void getUserByNameTest() { + void getUserByNameTest() { String username = null; // User response = api.getUserByName(username); @@ -99,7 +96,7 @@ public class UserApiTest { * */ @Test - public void loginUserTest() { + void loginUserTest() { String username = null; String password = null; // String response = api.loginUser(username, password); @@ -116,7 +113,7 @@ public class UserApiTest { * listing them out individually. */ @Test - public void loginUserTestQueryMap() { + void loginUserTestQueryMap() { UserApi.LoginUserQueryParams queryParams = new UserApi.LoginUserQueryParams() .username(null) .password(null); @@ -131,7 +128,7 @@ public class UserApiTest { * */ @Test - public void logoutUserTest() { + void logoutUserTest() { // api.logoutUser(); // TODO: test validations @@ -144,7 +141,7 @@ public class UserApiTest { * This can only be done by the logged in user. */ @Test - public void updateUserTest() { + void updateUserTest() { String username = null; User body = null; // api.updateUser(username, body); diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java index ec44af78387..488179591e5 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java @@ -16,27 +16,26 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.Map; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for AdditionalPropertiesAnyType */ -public class AdditionalPropertiesAnyTypeTest { +class AdditionalPropertiesAnyTypeTest { private final AdditionalPropertiesAnyType model = new AdditionalPropertiesAnyType(); /** * Model tests for AdditionalPropertiesAnyType */ @Test - public void testAdditionalPropertiesAnyType() { + void testAdditionalPropertiesAnyType() { // TODO: test AdditionalPropertiesAnyType } @@ -44,7 +43,7 @@ public class AdditionalPropertiesAnyTypeTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java index ceb024c5620..4a77e8b0461 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java @@ -16,28 +16,27 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for AdditionalPropertiesArray */ -public class AdditionalPropertiesArrayTest { +class AdditionalPropertiesArrayTest { private final AdditionalPropertiesArray model = new AdditionalPropertiesArray(); /** * Model tests for AdditionalPropertiesArray */ @Test - public void testAdditionalPropertiesArray() { + void testAdditionalPropertiesArray() { // TODO: test AdditionalPropertiesArray } @@ -45,7 +44,7 @@ public class AdditionalPropertiesArrayTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java index 517e5a10ae4..9a54e75aa25 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java @@ -16,27 +16,26 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.Map; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for AdditionalPropertiesBoolean */ -public class AdditionalPropertiesBooleanTest { +class AdditionalPropertiesBooleanTest { private final AdditionalPropertiesBoolean model = new AdditionalPropertiesBoolean(); /** * Model tests for AdditionalPropertiesBoolean */ @Test - public void testAdditionalPropertiesBoolean() { + void testAdditionalPropertiesBoolean() { // TODO: test AdditionalPropertiesBoolean } @@ -44,7 +43,7 @@ public class AdditionalPropertiesBooleanTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java index 2e3844ba975..59f6bd24c55 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -16,6 +16,7 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -23,22 +24,20 @@ import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for AdditionalPropertiesClass */ -public class AdditionalPropertiesClassTest { +class AdditionalPropertiesClassTest { private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); /** * Model tests for AdditionalPropertiesClass */ @Test - public void testAdditionalPropertiesClass() { + void testAdditionalPropertiesClass() { // TODO: test AdditionalPropertiesClass } @@ -46,7 +45,7 @@ public class AdditionalPropertiesClassTest { * Test the property 'mapString' */ @Test - public void mapStringTest() { + void mapStringTest() { // TODO: test mapString } @@ -54,7 +53,7 @@ public class AdditionalPropertiesClassTest { * Test the property 'mapNumber' */ @Test - public void mapNumberTest() { + void mapNumberTest() { // TODO: test mapNumber } @@ -62,7 +61,7 @@ public class AdditionalPropertiesClassTest { * Test the property 'mapInteger' */ @Test - public void mapIntegerTest() { + void mapIntegerTest() { // TODO: test mapInteger } @@ -70,7 +69,7 @@ public class AdditionalPropertiesClassTest { * Test the property 'mapBoolean' */ @Test - public void mapBooleanTest() { + void mapBooleanTest() { // TODO: test mapBoolean } @@ -78,7 +77,7 @@ public class AdditionalPropertiesClassTest { * Test the property 'mapArrayInteger' */ @Test - public void mapArrayIntegerTest() { + void mapArrayIntegerTest() { // TODO: test mapArrayInteger } @@ -86,7 +85,7 @@ public class AdditionalPropertiesClassTest { * Test the property 'mapArrayAnytype' */ @Test - public void mapArrayAnytypeTest() { + void mapArrayAnytypeTest() { // TODO: test mapArrayAnytype } @@ -94,7 +93,7 @@ public class AdditionalPropertiesClassTest { * Test the property 'mapMapString' */ @Test - public void mapMapStringTest() { + void mapMapStringTest() { // TODO: test mapMapString } @@ -102,7 +101,7 @@ public class AdditionalPropertiesClassTest { * Test the property 'mapMapAnytype' */ @Test - public void mapMapAnytypeTest() { + void mapMapAnytypeTest() { // TODO: test mapMapAnytype } @@ -110,7 +109,7 @@ public class AdditionalPropertiesClassTest { * Test the property 'anytype1' */ @Test - public void anytype1Test() { + void anytype1Test() { // TODO: test anytype1 } @@ -118,7 +117,7 @@ public class AdditionalPropertiesClassTest { * Test the property 'anytype2' */ @Test - public void anytype2Test() { + void anytype2Test() { // TODO: test anytype2 } @@ -126,7 +125,7 @@ public class AdditionalPropertiesClassTest { * Test the property 'anytype3' */ @Test - public void anytype3Test() { + void anytype3Test() { // TODO: test anytype3 } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java index 66a7b85623e..f7c270286d0 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java @@ -16,27 +16,26 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.Map; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for AdditionalPropertiesInteger */ -public class AdditionalPropertiesIntegerTest { +class AdditionalPropertiesIntegerTest { private final AdditionalPropertiesInteger model = new AdditionalPropertiesInteger(); /** * Model tests for AdditionalPropertiesInteger */ @Test - public void testAdditionalPropertiesInteger() { + void testAdditionalPropertiesInteger() { // TODO: test AdditionalPropertiesInteger } @@ -44,7 +43,7 @@ public class AdditionalPropertiesIntegerTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java index 4e03485a448..d8becbe8f04 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java @@ -16,28 +16,27 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for AdditionalPropertiesNumber */ -public class AdditionalPropertiesNumberTest { +class AdditionalPropertiesNumberTest { private final AdditionalPropertiesNumber model = new AdditionalPropertiesNumber(); /** * Model tests for AdditionalPropertiesNumber */ @Test - public void testAdditionalPropertiesNumber() { + void testAdditionalPropertiesNumber() { // TODO: test AdditionalPropertiesNumber } @@ -45,7 +44,7 @@ public class AdditionalPropertiesNumberTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java index e0c72c58634..80db912a75f 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java @@ -16,27 +16,26 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.Map; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for AdditionalPropertiesObject */ -public class AdditionalPropertiesObjectTest { +class AdditionalPropertiesObjectTest { private final AdditionalPropertiesObject model = new AdditionalPropertiesObject(); /** * Model tests for AdditionalPropertiesObject */ @Test - public void testAdditionalPropertiesObject() { + void testAdditionalPropertiesObject() { // TODO: test AdditionalPropertiesObject } @@ -44,7 +43,7 @@ public class AdditionalPropertiesObjectTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java index c84d987e764..9968da35455 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java @@ -16,27 +16,26 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.Map; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for AdditionalPropertiesString */ -public class AdditionalPropertiesStringTest { +class AdditionalPropertiesStringTest { private final AdditionalPropertiesString model = new AdditionalPropertiesString(); /** * Model tests for AdditionalPropertiesString */ @Test - public void testAdditionalPropertiesString() { + void testAdditionalPropertiesString() { // TODO: test AdditionalPropertiesString } @@ -44,7 +43,7 @@ public class AdditionalPropertiesStringTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AnimalTest.java index 7e79e5ca7b3..c8b84dd4f31 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AnimalTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -18,28 +18,27 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.client.model.BigCat; import org.openapitools.client.model.Cat; import org.openapitools.client.model.Dog; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for Animal */ -public class AnimalTest { +class AnimalTest { private final Animal model = new Animal(); /** * Model tests for Animal */ @Test - public void testAnimal() { + void testAnimal() { // TODO: test Animal } @@ -47,7 +46,7 @@ public class AnimalTest { * Test the property 'className' */ @Test - public void classNameTest() { + void classNameTest() { // TODO: test className } @@ -55,7 +54,7 @@ public class AnimalTest { * Test the property 'color' */ @Test - public void colorTest() { + void colorTest() { // TODO: test color } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java index e25187a3b60..e07106af8ff 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -16,28 +16,27 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for ArrayOfArrayOfNumberOnly */ -public class ArrayOfArrayOfNumberOnlyTest { +class ArrayOfArrayOfNumberOnlyTest { private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); /** * Model tests for ArrayOfArrayOfNumberOnly */ @Test - public void testArrayOfArrayOfNumberOnly() { + void testArrayOfArrayOfNumberOnly() { // TODO: test ArrayOfArrayOfNumberOnly } @@ -45,7 +44,7 @@ public class ArrayOfArrayOfNumberOnlyTest { * Test the property 'arrayArrayNumber' */ @Test - public void arrayArrayNumberTest() { + void arrayArrayNumberTest() { // TODO: test arrayArrayNumber } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java index ae106182399..0957f3f4adc 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -16,28 +16,27 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for ArrayOfNumberOnly */ -public class ArrayOfNumberOnlyTest { +class ArrayOfNumberOnlyTest { private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); /** * Model tests for ArrayOfNumberOnly */ @Test - public void testArrayOfNumberOnly() { + void testArrayOfNumberOnly() { // TODO: test ArrayOfNumberOnly } @@ -45,7 +44,7 @@ public class ArrayOfNumberOnlyTest { * Test the property 'arrayNumber' */ @Test - public void arrayNumberTest() { + void arrayNumberTest() { // TODO: test arrayNumber } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayTestTest.java index 36bd9951cf6..74b0886d6ad 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayTestTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -16,28 +16,27 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import org.openapitools.client.model.ReadOnlyFirst; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for ArrayTest */ -public class ArrayTestTest { +class ArrayTestTest { private final ArrayTest model = new ArrayTest(); /** * Model tests for ArrayTest */ @Test - public void testArrayTest() { + void testArrayTest() { // TODO: test ArrayTest } @@ -45,7 +44,7 @@ public class ArrayTestTest { * Test the property 'arrayOfString' */ @Test - public void arrayOfStringTest() { + void arrayOfStringTest() { // TODO: test arrayOfString } @@ -53,7 +52,7 @@ public class ArrayTestTest { * Test the property 'arrayArrayOfInteger' */ @Test - public void arrayArrayOfIntegerTest() { + void arrayArrayOfIntegerTest() { // TODO: test arrayArrayOfInteger } @@ -61,7 +60,7 @@ public class ArrayTestTest { * Test the property 'arrayArrayOfModel' */ @Test - public void arrayArrayOfModelTest() { + void arrayArrayOfModelTest() { // TODO: test arrayArrayOfModel } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java index a9b13011f00..2b79d23bab3 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for BigCatAllOf */ -public class BigCatAllOfTest { +class BigCatAllOfTest { private final BigCatAllOf model = new BigCatAllOf(); /** * Model tests for BigCatAllOf */ @Test - public void testBigCatAllOf() { + void testBigCatAllOf() { // TODO: test BigCatAllOf } @@ -42,7 +41,7 @@ public class BigCatAllOfTest { * Test the property 'kind' */ @Test - public void kindTest() { + void kindTest() { // TODO: test kind } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatTest.java index b3afa31d289..32af94c3981 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -18,27 +18,26 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.client.model.BigCatAllOf; import org.openapitools.client.model.Cat; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for BigCat */ -public class BigCatTest { +class BigCatTest { private final BigCat model = new BigCat(); /** * Model tests for BigCat */ @Test - public void testBigCat() { + void testBigCat() { // TODO: test BigCat } @@ -46,7 +45,7 @@ public class BigCatTest { * Test the property 'className' */ @Test - public void classNameTest() { + void classNameTest() { // TODO: test className } @@ -54,7 +53,7 @@ public class BigCatTest { * Test the property 'color' */ @Test - public void colorTest() { + void colorTest() { // TODO: test color } @@ -62,7 +61,7 @@ public class BigCatTest { * Test the property 'declawed' */ @Test - public void declawedTest() { + void declawedTest() { // TODO: test declawed } @@ -70,7 +69,7 @@ public class BigCatTest { * Test the property 'kind' */ @Test - public void kindTest() { + void kindTest() { // TODO: test kind } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CapitalizationTest.java index a701b341fc5..d91e81773ff 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CapitalizationTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CapitalizationTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for Capitalization */ -public class CapitalizationTest { +class CapitalizationTest { private final Capitalization model = new Capitalization(); /** * Model tests for Capitalization */ @Test - public void testCapitalization() { + void testCapitalization() { // TODO: test Capitalization } @@ -42,7 +41,7 @@ public class CapitalizationTest { * Test the property 'smallCamel' */ @Test - public void smallCamelTest() { + void smallCamelTest() { // TODO: test smallCamel } @@ -50,7 +49,7 @@ public class CapitalizationTest { * Test the property 'capitalCamel' */ @Test - public void capitalCamelTest() { + void capitalCamelTest() { // TODO: test capitalCamel } @@ -58,7 +57,7 @@ public class CapitalizationTest { * Test the property 'smallSnake' */ @Test - public void smallSnakeTest() { + void smallSnakeTest() { // TODO: test smallSnake } @@ -66,7 +65,7 @@ public class CapitalizationTest { * Test the property 'capitalSnake' */ @Test - public void capitalSnakeTest() { + void capitalSnakeTest() { // TODO: test capitalSnake } @@ -74,7 +73,7 @@ public class CapitalizationTest { * Test the property 'scAETHFlowPoints' */ @Test - public void scAETHFlowPointsTest() { + void scAETHFlowPointsTest() { // TODO: test scAETHFlowPoints } @@ -82,7 +81,7 @@ public class CapitalizationTest { * Test the property 'ATT_NAME' */ @Test - public void ATT_NAMETest() { + void ATT_NAMETest() { // TODO: test ATT_NAME } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CatAllOfTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CatAllOfTest.java index 1d85a044725..b13bcf1e7a1 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CatAllOfTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CatAllOfTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for CatAllOf */ -public class CatAllOfTest { +class CatAllOfTest { private final CatAllOf model = new CatAllOf(); /** * Model tests for CatAllOf */ @Test - public void testCatAllOf() { + void testCatAllOf() { // TODO: test CatAllOf } @@ -42,7 +41,7 @@ public class CatAllOfTest { * Test the property 'declawed' */ @Test - public void declawedTest() { + void declawedTest() { // TODO: test declawed } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CatTest.java index d0952b50100..f8f63d1f2eb 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CatTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CatTest.java @@ -18,28 +18,27 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.client.model.Animal; import org.openapitools.client.model.BigCat; import org.openapitools.client.model.CatAllOf; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for Cat */ -public class CatTest { +class CatTest { private final Cat model = new Cat(); /** * Model tests for Cat */ @Test - public void testCat() { + void testCat() { // TODO: test Cat } @@ -47,7 +46,7 @@ public class CatTest { * Test the property 'className' */ @Test - public void classNameTest() { + void classNameTest() { // TODO: test className } @@ -55,7 +54,7 @@ public class CatTest { * Test the property 'color' */ @Test - public void colorTest() { + void colorTest() { // TODO: test color } @@ -63,7 +62,7 @@ public class CatTest { * Test the property 'declawed' */ @Test - public void declawedTest() { + void declawedTest() { // TODO: test declawed } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CategoryTest.java index 6027994a2ac..22583f947c3 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CategoryTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for Category */ -public class CategoryTest { +class CategoryTest { private final Category model = new Category(); /** * Model tests for Category */ @Test - public void testCategory() { + void testCategory() { // TODO: test Category } @@ -42,7 +41,7 @@ public class CategoryTest { * Test the property 'id' */ @Test - public void idTest() { + void idTest() { // TODO: test id } @@ -50,7 +49,7 @@ public class CategoryTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ClassModelTest.java index 8914c9cad43..44d9611e0dc 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ClassModelTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for ClassModel */ -public class ClassModelTest { +class ClassModelTest { private final ClassModel model = new ClassModel(); /** * Model tests for ClassModel */ @Test - public void testClassModel() { + void testClassModel() { // TODO: test ClassModel } @@ -42,7 +41,7 @@ public class ClassModelTest { * Test the property 'propertyClass' */ @Test - public void propertyClassTest() { + void propertyClassTest() { // TODO: test propertyClass } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ClientTest.java index c21b346272d..ff12463d5cf 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ClientTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ClientTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for Client */ -public class ClientTest { +class ClientTest { private final Client model = new Client(); /** * Model tests for Client */ @Test - public void testClient() { + void testClient() { // TODO: test Client } @@ -42,7 +41,7 @@ public class ClientTest { * Test the property 'client' */ @Test - public void clientTest() { + void clientTest() { // TODO: test client } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/DogAllOfTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/DogAllOfTest.java index 6e4b4910809..ab8a1b63af4 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/DogAllOfTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/DogAllOfTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for DogAllOf */ -public class DogAllOfTest { +class DogAllOfTest { private final DogAllOf model = new DogAllOf(); /** * Model tests for DogAllOf */ @Test - public void testDogAllOf() { + void testDogAllOf() { // TODO: test DogAllOf } @@ -42,7 +41,7 @@ public class DogAllOfTest { * Test the property 'breed' */ @Test - public void breedTest() { + void breedTest() { // TODO: test breed } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/DogTest.java index 3446815a300..705a0429377 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/DogTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/DogTest.java @@ -18,27 +18,26 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.client.model.Animal; import org.openapitools.client.model.DogAllOf; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for Dog */ -public class DogTest { +class DogTest { private final Dog model = new Dog(); /** * Model tests for Dog */ @Test - public void testDog() { + void testDog() { // TODO: test Dog } @@ -46,7 +45,7 @@ public class DogTest { * Test the property 'className' */ @Test - public void classNameTest() { + void classNameTest() { // TODO: test className } @@ -54,7 +53,7 @@ public class DogTest { * Test the property 'color' */ @Test - public void colorTest() { + void colorTest() { // TODO: test color } @@ -62,7 +61,7 @@ public class DogTest { * Test the property 'breed' */ @Test - public void breedTest() { + void breedTest() { // TODO: test breed } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumArraysTest.java index 45b8fbbd822..1ed1044bac9 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumArraysTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumArraysTest.java @@ -16,27 +16,26 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for EnumArrays */ -public class EnumArraysTest { +class EnumArraysTest { private final EnumArrays model = new EnumArrays(); /** * Model tests for EnumArrays */ @Test - public void testEnumArrays() { + void testEnumArrays() { // TODO: test EnumArrays } @@ -44,7 +43,7 @@ public class EnumArraysTest { * Test the property 'justSymbol' */ @Test - public void justSymbolTest() { + void justSymbolTest() { // TODO: test justSymbol } @@ -52,7 +51,7 @@ public class EnumArraysTest { * Test the property 'arrayEnum' */ @Test - public void arrayEnumTest() { + void arrayEnumTest() { // TODO: test arrayEnum } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumClassTest.java index 9e45543facd..55b946a9f7c 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumClassTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumClassTest.java @@ -13,20 +13,18 @@ package org.openapitools.client.model; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for EnumClass */ -public class EnumClassTest { +class EnumClassTest { /** * Model tests for EnumClass */ @Test - public void testEnumClass() { + void testEnumClass() { // TODO: test EnumClass } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumTestTest.java index 04e7afb1978..c22b632038a 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumTestTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -16,26 +16,25 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.client.model.OuterEnum; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for EnumTest */ -public class EnumTestTest { +class EnumTestTest { private final EnumTest model = new EnumTest(); /** * Model tests for EnumTest */ @Test - public void testEnumTest() { + void testEnumTest() { // TODO: test EnumTest } @@ -43,7 +42,7 @@ public class EnumTestTest { * Test the property 'enumString' */ @Test - public void enumStringTest() { + void enumStringTest() { // TODO: test enumString } @@ -51,7 +50,7 @@ public class EnumTestTest { * Test the property 'enumStringRequired' */ @Test - public void enumStringRequiredTest() { + void enumStringRequiredTest() { // TODO: test enumStringRequired } @@ -59,7 +58,7 @@ public class EnumTestTest { * Test the property 'enumInteger' */ @Test - public void enumIntegerTest() { + void enumIntegerTest() { // TODO: test enumInteger } @@ -67,7 +66,7 @@ public class EnumTestTest { * Test the property 'enumNumber' */ @Test - public void enumNumberTest() { + void enumNumberTest() { // TODO: test enumNumber } @@ -75,7 +74,7 @@ public class EnumTestTest { * Test the property 'outerEnum' */ @Test - public void outerEnumTest() { + void outerEnumTest() { // TODO: test outerEnum } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java index ef37e666be3..dc539f34554 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -16,27 +16,26 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for FileSchemaTestClass */ -public class FileSchemaTestClassTest { +class FileSchemaTestClassTest { private final FileSchemaTestClass model = new FileSchemaTestClass(); /** * Model tests for FileSchemaTestClass */ @Test - public void testFileSchemaTestClass() { + void testFileSchemaTestClass() { // TODO: test FileSchemaTestClass } @@ -44,7 +43,7 @@ public class FileSchemaTestClassTest { * Test the property 'file' */ @Test - public void fileTest() { + void fileTest() { // TODO: test file } @@ -52,7 +51,7 @@ public class FileSchemaTestClassTest { * Test the property 'files' */ @Test - public void filesTest() { + void filesTest() { // TODO: test files } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FormatTestTest.java index 710501b51bd..fdc269f4259 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FormatTestTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -16,6 +16,7 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -24,22 +25,20 @@ import java.math.BigDecimal; import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for FormatTest */ -public class FormatTestTest { +class FormatTestTest { private final FormatTest model = new FormatTest(); /** * Model tests for FormatTest */ @Test - public void testFormatTest() { + void testFormatTest() { // TODO: test FormatTest } @@ -47,7 +46,7 @@ public class FormatTestTest { * Test the property 'integer' */ @Test - public void integerTest() { + void integerTest() { // TODO: test integer } @@ -55,7 +54,7 @@ public class FormatTestTest { * Test the property 'int32' */ @Test - public void int32Test() { + void int32Test() { // TODO: test int32 } @@ -63,7 +62,7 @@ public class FormatTestTest { * Test the property 'int64' */ @Test - public void int64Test() { + void int64Test() { // TODO: test int64 } @@ -71,7 +70,7 @@ public class FormatTestTest { * Test the property 'number' */ @Test - public void numberTest() { + void numberTest() { // TODO: test number } @@ -79,7 +78,7 @@ public class FormatTestTest { * Test the property '_float' */ @Test - public void _floatTest() { + void _floatTest() { // TODO: test _float } @@ -87,7 +86,7 @@ public class FormatTestTest { * Test the property '_double' */ @Test - public void _doubleTest() { + void _doubleTest() { // TODO: test _double } @@ -95,7 +94,7 @@ public class FormatTestTest { * Test the property 'string' */ @Test - public void stringTest() { + void stringTest() { // TODO: test string } @@ -103,7 +102,7 @@ public class FormatTestTest { * Test the property '_byte' */ @Test - public void _byteTest() { + void _byteTest() { // TODO: test _byte } @@ -111,7 +110,7 @@ public class FormatTestTest { * Test the property 'binary' */ @Test - public void binaryTest() { + void binaryTest() { // TODO: test binary } @@ -119,7 +118,7 @@ public class FormatTestTest { * Test the property 'date' */ @Test - public void dateTest() { + void dateTest() { // TODO: test date } @@ -127,7 +126,7 @@ public class FormatTestTest { * Test the property 'dateTime' */ @Test - public void dateTimeTest() { + void dateTimeTest() { // TODO: test dateTime } @@ -135,7 +134,7 @@ public class FormatTestTest { * Test the property 'uuid' */ @Test - public void uuidTest() { + void uuidTest() { // TODO: test uuid } @@ -143,7 +142,7 @@ public class FormatTestTest { * Test the property 'password' */ @Test - public void passwordTest() { + void passwordTest() { // TODO: test password } @@ -151,7 +150,7 @@ public class FormatTestTest { * Test the property 'bigDecimal' */ @Test - public void bigDecimalTest() { + void bigDecimalTest() { // TODO: test bigDecimal } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java index e902c100383..224c1ad22b0 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for HasOnlyReadOnly */ -public class HasOnlyReadOnlyTest { +class HasOnlyReadOnlyTest { private final HasOnlyReadOnly model = new HasOnlyReadOnly(); /** * Model tests for HasOnlyReadOnly */ @Test - public void testHasOnlyReadOnly() { + void testHasOnlyReadOnly() { // TODO: test HasOnlyReadOnly } @@ -42,7 +41,7 @@ public class HasOnlyReadOnlyTest { * Test the property 'bar' */ @Test - public void barTest() { + void barTest() { // TODO: test bar } @@ -50,7 +49,7 @@ public class HasOnlyReadOnlyTest { * Test the property 'foo' */ @Test - public void fooTest() { + void fooTest() { // TODO: test foo } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/MapTestTest.java index a0c991bb758..21187f97510 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/MapTestTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -16,28 +16,27 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for MapTest */ -public class MapTestTest { +class MapTestTest { private final MapTest model = new MapTest(); /** * Model tests for MapTest */ @Test - public void testMapTest() { + void testMapTest() { // TODO: test MapTest } @@ -45,7 +44,7 @@ public class MapTestTest { * Test the property 'mapMapOfString' */ @Test - public void mapMapOfStringTest() { + void mapMapOfStringTest() { // TODO: test mapMapOfString } @@ -53,7 +52,7 @@ public class MapTestTest { * Test the property 'mapOfEnumString' */ @Test - public void mapOfEnumStringTest() { + void mapOfEnumStringTest() { // TODO: test mapOfEnumString } @@ -61,7 +60,7 @@ public class MapTestTest { * Test the property 'directMap' */ @Test - public void directMapTest() { + void directMapTest() { // TODO: test directMap } @@ -69,7 +68,7 @@ public class MapTestTest { * Test the property 'indirectMap' */ @Test - public void indirectMapTest() { + void indirectMapTest() { // TODO: test indirectMap } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java index f8a8c734baa..b2ce8721036 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -16,6 +16,7 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -25,22 +26,20 @@ import java.util.Map; import java.util.UUID; import org.openapitools.client.model.Animal; import org.threeten.bp.OffsetDateTime; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for MixedPropertiesAndAdditionalPropertiesClass */ -public class MixedPropertiesAndAdditionalPropertiesClassTest { +class MixedPropertiesAndAdditionalPropertiesClassTest { private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); /** * Model tests for MixedPropertiesAndAdditionalPropertiesClass */ @Test - public void testMixedPropertiesAndAdditionalPropertiesClass() { + void testMixedPropertiesAndAdditionalPropertiesClass() { // TODO: test MixedPropertiesAndAdditionalPropertiesClass } @@ -48,7 +47,7 @@ public class MixedPropertiesAndAdditionalPropertiesClassTest { * Test the property 'uuid' */ @Test - public void uuidTest() { + void uuidTest() { // TODO: test uuid } @@ -56,7 +55,7 @@ public class MixedPropertiesAndAdditionalPropertiesClassTest { * Test the property 'dateTime' */ @Test - public void dateTimeTest() { + void dateTimeTest() { // TODO: test dateTime } @@ -64,7 +63,7 @@ public class MixedPropertiesAndAdditionalPropertiesClassTest { * Test the property 'map' */ @Test - public void mapTest() { + void mapTest() { // TODO: test map } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/Model200ResponseTest.java index 82c7208079d..0a0f7aa7554 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/Model200ResponseTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for Model200Response */ -public class Model200ResponseTest { +class Model200ResponseTest { private final Model200Response model = new Model200Response(); /** * Model tests for Model200Response */ @Test - public void testModel200Response() { + void testModel200Response() { // TODO: test Model200Response } @@ -42,7 +41,7 @@ public class Model200ResponseTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } @@ -50,7 +49,7 @@ public class Model200ResponseTest { * Test the property 'propertyClass' */ @Test - public void propertyClassTest() { + void propertyClassTest() { // TODO: test propertyClass } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java index 97a1287aa41..9c746af8be0 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for ModelApiResponse */ -public class ModelApiResponseTest { +class ModelApiResponseTest { private final ModelApiResponse model = new ModelApiResponse(); /** * Model tests for ModelApiResponse */ @Test - public void testModelApiResponse() { + void testModelApiResponse() { // TODO: test ModelApiResponse } @@ -42,7 +41,7 @@ public class ModelApiResponseTest { * Test the property 'code' */ @Test - public void codeTest() { + void codeTest() { // TODO: test code } @@ -50,7 +49,7 @@ public class ModelApiResponseTest { * Test the property 'type' */ @Test - public void typeTest() { + void typeTest() { // TODO: test type } @@ -58,7 +57,7 @@ public class ModelApiResponseTest { * Test the property 'message' */ @Test - public void messageTest() { + void messageTest() { // TODO: test message } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ModelReturnTest.java index f884519ebc8..e1bddc25f2d 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ModelReturnTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for ModelReturn */ -public class ModelReturnTest { +class ModelReturnTest { private final ModelReturn model = new ModelReturn(); /** * Model tests for ModelReturn */ @Test - public void testModelReturn() { + void testModelReturn() { // TODO: test ModelReturn } @@ -42,7 +41,7 @@ public class ModelReturnTest { * Test the property '_return' */ @Test - public void _returnTest() { + void _returnTest() { // TODO: test _return } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/NameTest.java index cb3a94cf74a..13ae33a2084 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/NameTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/NameTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for Name */ -public class NameTest { +class NameTest { private final Name model = new Name(); /** * Model tests for Name */ @Test - public void testName() { + void testName() { // TODO: test Name } @@ -42,7 +41,7 @@ public class NameTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } @@ -50,7 +49,7 @@ public class NameTest { * Test the property 'snakeCase' */ @Test - public void snakeCaseTest() { + void snakeCaseTest() { // TODO: test snakeCase } @@ -58,7 +57,7 @@ public class NameTest { * Test the property 'property' */ @Test - public void propertyTest() { + void propertyTest() { // TODO: test property } @@ -66,7 +65,7 @@ public class NameTest { * Test the property '_123number' */ @Test - public void _123numberTest() { + void _123numberTest() { // TODO: test _123number } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/NumberOnlyTest.java index f4fbd5ee8b4..4a600363e15 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/NumberOnlyTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/NumberOnlyTest.java @@ -16,26 +16,25 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for NumberOnly */ -public class NumberOnlyTest { +class NumberOnlyTest { private final NumberOnly model = new NumberOnly(); /** * Model tests for NumberOnly */ @Test - public void testNumberOnly() { + void testNumberOnly() { // TODO: test NumberOnly } @@ -43,7 +42,7 @@ public class NumberOnlyTest { * Test the property 'justNumber' */ @Test - public void justNumberTest() { + void justNumberTest() { // TODO: test justNumber } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OrderTest.java index d24c8479f5d..f84bff7dca9 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OrderTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OrderTest.java @@ -16,26 +16,25 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.threeten.bp.OffsetDateTime; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for Order */ -public class OrderTest { +class OrderTest { private final Order model = new Order(); /** * Model tests for Order */ @Test - public void testOrder() { + void testOrder() { // TODO: test Order } @@ -43,7 +42,7 @@ public class OrderTest { * Test the property 'id' */ @Test - public void idTest() { + void idTest() { // TODO: test id } @@ -51,7 +50,7 @@ public class OrderTest { * Test the property 'petId' */ @Test - public void petIdTest() { + void petIdTest() { // TODO: test petId } @@ -59,7 +58,7 @@ public class OrderTest { * Test the property 'quantity' */ @Test - public void quantityTest() { + void quantityTest() { // TODO: test quantity } @@ -67,7 +66,7 @@ public class OrderTest { * Test the property 'shipDate' */ @Test - public void shipDateTest() { + void shipDateTest() { // TODO: test shipDate } @@ -75,7 +74,7 @@ public class OrderTest { * Test the property 'status' */ @Test - public void statusTest() { + void statusTest() { // TODO: test status } @@ -83,7 +82,7 @@ public class OrderTest { * Test the property 'complete' */ @Test - public void completeTest() { + void completeTest() { // TODO: test complete } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OuterCompositeTest.java index ebea3ca304c..c42f4fd0478 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OuterCompositeTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OuterCompositeTest.java @@ -16,26 +16,25 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for OuterComposite */ -public class OuterCompositeTest { +class OuterCompositeTest { private final OuterComposite model = new OuterComposite(); /** * Model tests for OuterComposite */ @Test - public void testOuterComposite() { + void testOuterComposite() { // TODO: test OuterComposite } @@ -43,7 +42,7 @@ public class OuterCompositeTest { * Test the property 'myNumber' */ @Test - public void myNumberTest() { + void myNumberTest() { // TODO: test myNumber } @@ -51,7 +50,7 @@ public class OuterCompositeTest { * Test the property 'myString' */ @Test - public void myStringTest() { + void myStringTest() { // TODO: test myString } @@ -59,7 +58,7 @@ public class OuterCompositeTest { * Test the property 'myBoolean' */ @Test - public void myBooleanTest() { + void myBooleanTest() { // TODO: test myBoolean } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OuterEnumTest.java index cf0ebae0faf..fd8833deb8b 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OuterEnumTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/OuterEnumTest.java @@ -13,20 +13,18 @@ package org.openapitools.client.model; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for OuterEnum */ -public class OuterEnumTest { +class OuterEnumTest { /** * Model tests for OuterEnum */ @Test - public void testOuterEnum() { + void testOuterEnum() { // TODO: test OuterEnum } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/PetTest.java index 4065f7ca1a4..f7276f8e317 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/PetTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/PetTest.java @@ -16,6 +16,7 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -25,22 +26,20 @@ import java.util.List; import java.util.Set; import org.openapitools.client.model.Category; import org.openapitools.client.model.Tag; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for Pet */ -public class PetTest { +class PetTest { private final Pet model = new Pet(); /** * Model tests for Pet */ @Test - public void testPet() { + void testPet() { // TODO: test Pet } @@ -48,7 +47,7 @@ public class PetTest { * Test the property 'id' */ @Test - public void idTest() { + void idTest() { // TODO: test id } @@ -56,7 +55,7 @@ public class PetTest { * Test the property 'category' */ @Test - public void categoryTest() { + void categoryTest() { // TODO: test category } @@ -64,7 +63,7 @@ public class PetTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } @@ -72,7 +71,7 @@ public class PetTest { * Test the property 'photoUrls' */ @Test - public void photoUrlsTest() { + void photoUrlsTest() { // TODO: test photoUrls } @@ -80,7 +79,7 @@ public class PetTest { * Test the property 'tags' */ @Test - public void tagsTest() { + void tagsTest() { // TODO: test tags } @@ -88,7 +87,7 @@ public class PetTest { * Test the property 'status' */ @Test - public void statusTest() { + void statusTest() { // TODO: test status } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java index b82a7d0ef56..a8dd8e92722 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for ReadOnlyFirst */ -public class ReadOnlyFirstTest { +class ReadOnlyFirstTest { private final ReadOnlyFirst model = new ReadOnlyFirst(); /** * Model tests for ReadOnlyFirst */ @Test - public void testReadOnlyFirst() { + void testReadOnlyFirst() { // TODO: test ReadOnlyFirst } @@ -42,7 +41,7 @@ public class ReadOnlyFirstTest { * Test the property 'bar' */ @Test - public void barTest() { + void barTest() { // TODO: test bar } @@ -50,7 +49,7 @@ public class ReadOnlyFirstTest { * Test the property 'baz' */ @Test - public void bazTest() { + void bazTest() { // TODO: test baz } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java index d5a19c371e6..028705916ee 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for SpecialModelName */ -public class SpecialModelNameTest { +class SpecialModelNameTest { private final SpecialModelName model = new SpecialModelName(); /** * Model tests for SpecialModelName */ @Test - public void testSpecialModelName() { + void testSpecialModelName() { // TODO: test SpecialModelName } @@ -42,7 +41,7 @@ public class SpecialModelNameTest { * Test the property '$specialPropertyName' */ @Test - public void $specialPropertyNameTest() { + void $specialPropertyNameTest() { // TODO: test $specialPropertyName } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TagTest.java index 5c2cc6f49e0..174a9319f89 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TagTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TagTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for Tag */ -public class TagTest { +class TagTest { private final Tag model = new Tag(); /** * Model tests for Tag */ @Test - public void testTag() { + void testTag() { // TODO: test Tag } @@ -42,7 +41,7 @@ public class TagTest { * Test the property 'id' */ @Test - public void idTest() { + void idTest() { // TODO: test id } @@ -50,7 +49,7 @@ public class TagTest { * Test the property 'name' */ @Test - public void nameTest() { + void nameTest() { // TODO: test name } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java index e96ac744439..f425fc23a78 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java @@ -16,28 +16,27 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for TypeHolderDefault */ -public class TypeHolderDefaultTest { +class TypeHolderDefaultTest { private final TypeHolderDefault model = new TypeHolderDefault(); /** * Model tests for TypeHolderDefault */ @Test - public void testTypeHolderDefault() { + void testTypeHolderDefault() { // TODO: test TypeHolderDefault } @@ -45,7 +44,7 @@ public class TypeHolderDefaultTest { * Test the property 'stringItem' */ @Test - public void stringItemTest() { + void stringItemTest() { // TODO: test stringItem } @@ -53,7 +52,7 @@ public class TypeHolderDefaultTest { * Test the property 'numberItem' */ @Test - public void numberItemTest() { + void numberItemTest() { // TODO: test numberItem } @@ -61,7 +60,7 @@ public class TypeHolderDefaultTest { * Test the property 'integerItem' */ @Test - public void integerItemTest() { + void integerItemTest() { // TODO: test integerItem } @@ -69,7 +68,7 @@ public class TypeHolderDefaultTest { * Test the property 'boolItem' */ @Test - public void boolItemTest() { + void boolItemTest() { // TODO: test boolItem } @@ -77,7 +76,7 @@ public class TypeHolderDefaultTest { * Test the property 'arrayItem' */ @Test - public void arrayItemTest() { + void arrayItemTest() { // TODO: test arrayItem } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java index 56641d163a5..3c67b8b650f 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java @@ -16,28 +16,27 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for TypeHolderExample */ -public class TypeHolderExampleTest { +class TypeHolderExampleTest { private final TypeHolderExample model = new TypeHolderExample(); /** * Model tests for TypeHolderExample */ @Test - public void testTypeHolderExample() { + void testTypeHolderExample() { // TODO: test TypeHolderExample } @@ -45,7 +44,7 @@ public class TypeHolderExampleTest { * Test the property 'stringItem' */ @Test - public void stringItemTest() { + void stringItemTest() { // TODO: test stringItem } @@ -53,7 +52,7 @@ public class TypeHolderExampleTest { * Test the property 'numberItem' */ @Test - public void numberItemTest() { + void numberItemTest() { // TODO: test numberItem } @@ -61,7 +60,7 @@ public class TypeHolderExampleTest { * Test the property 'floatItem' */ @Test - public void floatItemTest() { + void floatItemTest() { // TODO: test floatItem } @@ -69,7 +68,7 @@ public class TypeHolderExampleTest { * Test the property 'integerItem' */ @Test - public void integerItemTest() { + void integerItemTest() { // TODO: test integerItem } @@ -77,7 +76,7 @@ public class TypeHolderExampleTest { * Test the property 'boolItem' */ @Test - public void boolItemTest() { + void boolItemTest() { // TODO: test boolItem } @@ -85,7 +84,7 @@ public class TypeHolderExampleTest { * Test the property 'arrayItem' */ @Test - public void arrayItemTest() { + void arrayItemTest() { // TODO: test arrayItem } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/UserTest.java index ce40d3a2a63..f01cfceed72 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/UserTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/UserTest.java @@ -16,25 +16,24 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for User */ -public class UserTest { +class UserTest { private final User model = new User(); /** * Model tests for User */ @Test - public void testUser() { + void testUser() { // TODO: test User } @@ -42,7 +41,7 @@ public class UserTest { * Test the property 'id' */ @Test - public void idTest() { + void idTest() { // TODO: test id } @@ -50,7 +49,7 @@ public class UserTest { * Test the property 'username' */ @Test - public void usernameTest() { + void usernameTest() { // TODO: test username } @@ -58,7 +57,7 @@ public class UserTest { * Test the property 'firstName' */ @Test - public void firstNameTest() { + void firstNameTest() { // TODO: test firstName } @@ -66,7 +65,7 @@ public class UserTest { * Test the property 'lastName' */ @Test - public void lastNameTest() { + void lastNameTest() { // TODO: test lastName } @@ -74,7 +73,7 @@ public class UserTest { * Test the property 'email' */ @Test - public void emailTest() { + void emailTest() { // TODO: test email } @@ -82,7 +81,7 @@ public class UserTest { * Test the property 'password' */ @Test - public void passwordTest() { + void passwordTest() { // TODO: test password } @@ -90,7 +89,7 @@ public class UserTest { * Test the property 'phone' */ @Test - public void phoneTest() { + void phoneTest() { // TODO: test phone } @@ -98,7 +97,7 @@ public class UserTest { * Test the property 'userStatus' */ @Test - public void userStatusTest() { + void userStatusTest() { // TODO: test userStatus } diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/XmlItemTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/XmlItemTest.java index 501c414555f..6649fefb885 100644 --- a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/XmlItemTest.java +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/XmlItemTest.java @@ -16,28 +16,27 @@ package org.openapitools.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Model tests for XmlItem */ -public class XmlItemTest { +class XmlItemTest { private final XmlItem model = new XmlItem(); /** * Model tests for XmlItem */ @Test - public void testXmlItem() { + void testXmlItem() { // TODO: test XmlItem } @@ -45,7 +44,7 @@ public class XmlItemTest { * Test the property 'attributeString' */ @Test - public void attributeStringTest() { + void attributeStringTest() { // TODO: test attributeString } @@ -53,7 +52,7 @@ public class XmlItemTest { * Test the property 'attributeNumber' */ @Test - public void attributeNumberTest() { + void attributeNumberTest() { // TODO: test attributeNumber } @@ -61,7 +60,7 @@ public class XmlItemTest { * Test the property 'attributeInteger' */ @Test - public void attributeIntegerTest() { + void attributeIntegerTest() { // TODO: test attributeInteger } @@ -69,7 +68,7 @@ public class XmlItemTest { * Test the property 'attributeBoolean' */ @Test - public void attributeBooleanTest() { + void attributeBooleanTest() { // TODO: test attributeBoolean } @@ -77,7 +76,7 @@ public class XmlItemTest { * Test the property 'wrappedArray' */ @Test - public void wrappedArrayTest() { + void wrappedArrayTest() { // TODO: test wrappedArray } @@ -85,7 +84,7 @@ public class XmlItemTest { * Test the property 'nameString' */ @Test - public void nameStringTest() { + void nameStringTest() { // TODO: test nameString } @@ -93,7 +92,7 @@ public class XmlItemTest { * Test the property 'nameNumber' */ @Test - public void nameNumberTest() { + void nameNumberTest() { // TODO: test nameNumber } @@ -101,7 +100,7 @@ public class XmlItemTest { * Test the property 'nameInteger' */ @Test - public void nameIntegerTest() { + void nameIntegerTest() { // TODO: test nameInteger } @@ -109,7 +108,7 @@ public class XmlItemTest { * Test the property 'nameBoolean' */ @Test - public void nameBooleanTest() { + void nameBooleanTest() { // TODO: test nameBoolean } @@ -117,7 +116,7 @@ public class XmlItemTest { * Test the property 'nameArray' */ @Test - public void nameArrayTest() { + void nameArrayTest() { // TODO: test nameArray } @@ -125,7 +124,7 @@ public class XmlItemTest { * Test the property 'nameWrappedArray' */ @Test - public void nameWrappedArrayTest() { + void nameWrappedArrayTest() { // TODO: test nameWrappedArray } @@ -133,7 +132,7 @@ public class XmlItemTest { * Test the property 'prefixString' */ @Test - public void prefixStringTest() { + void prefixStringTest() { // TODO: test prefixString } @@ -141,7 +140,7 @@ public class XmlItemTest { * Test the property 'prefixNumber' */ @Test - public void prefixNumberTest() { + void prefixNumberTest() { // TODO: test prefixNumber } @@ -149,7 +148,7 @@ public class XmlItemTest { * Test the property 'prefixInteger' */ @Test - public void prefixIntegerTest() { + void prefixIntegerTest() { // TODO: test prefixInteger } @@ -157,7 +156,7 @@ public class XmlItemTest { * Test the property 'prefixBoolean' */ @Test - public void prefixBooleanTest() { + void prefixBooleanTest() { // TODO: test prefixBoolean } @@ -165,7 +164,7 @@ public class XmlItemTest { * Test the property 'prefixArray' */ @Test - public void prefixArrayTest() { + void prefixArrayTest() { // TODO: test prefixArray } @@ -173,7 +172,7 @@ public class XmlItemTest { * Test the property 'prefixWrappedArray' */ @Test - public void prefixWrappedArrayTest() { + void prefixWrappedArrayTest() { // TODO: test prefixWrappedArray } @@ -181,7 +180,7 @@ public class XmlItemTest { * Test the property 'namespaceString' */ @Test - public void namespaceStringTest() { + void namespaceStringTest() { // TODO: test namespaceString } @@ -189,7 +188,7 @@ public class XmlItemTest { * Test the property 'namespaceNumber' */ @Test - public void namespaceNumberTest() { + void namespaceNumberTest() { // TODO: test namespaceNumber } @@ -197,7 +196,7 @@ public class XmlItemTest { * Test the property 'namespaceInteger' */ @Test - public void namespaceIntegerTest() { + void namespaceIntegerTest() { // TODO: test namespaceInteger } @@ -205,7 +204,7 @@ public class XmlItemTest { * Test the property 'namespaceBoolean' */ @Test - public void namespaceBooleanTest() { + void namespaceBooleanTest() { // TODO: test namespaceBoolean } @@ -213,7 +212,7 @@ public class XmlItemTest { * Test the property 'namespaceArray' */ @Test - public void namespaceArrayTest() { + void namespaceArrayTest() { // TODO: test namespaceArray } @@ -221,7 +220,7 @@ public class XmlItemTest { * Test the property 'namespaceWrappedArray' */ @Test - public void namespaceWrappedArrayTest() { + void namespaceWrappedArrayTest() { // TODO: test namespaceWrappedArray } @@ -229,7 +228,7 @@ public class XmlItemTest { * Test the property 'prefixNsString' */ @Test - public void prefixNsStringTest() { + void prefixNsStringTest() { // TODO: test prefixNsString } @@ -237,7 +236,7 @@ public class XmlItemTest { * Test the property 'prefixNsNumber' */ @Test - public void prefixNsNumberTest() { + void prefixNsNumberTest() { // TODO: test prefixNsNumber } @@ -245,7 +244,7 @@ public class XmlItemTest { * Test the property 'prefixNsInteger' */ @Test - public void prefixNsIntegerTest() { + void prefixNsIntegerTest() { // TODO: test prefixNsInteger } @@ -253,7 +252,7 @@ public class XmlItemTest { * Test the property 'prefixNsBoolean' */ @Test - public void prefixNsBooleanTest() { + void prefixNsBooleanTest() { // TODO: test prefixNsBoolean } @@ -261,7 +260,7 @@ public class XmlItemTest { * Test the property 'prefixNsArray' */ @Test - public void prefixNsArrayTest() { + void prefixNsArrayTest() { // TODO: test prefixNsArray } @@ -269,7 +268,7 @@ public class XmlItemTest { * Test the property 'prefixNsWrappedArray' */ @Test - public void prefixNsWrappedArrayTest() { + void prefixNsWrappedArrayTest() { // TODO: test prefixNsWrappedArray } diff --git a/samples/client/petstore/java/feign/src/test/resources/logback-test.xml b/samples/client/petstore/java/feign/src/test/resources/logback-test.xml new file mode 100644 index 00000000000..b31d58ec211 --- /dev/null +++ b/samples/client/petstore/java/feign/src/test/resources/logback-test.xml @@ -0,0 +1,10 @@ + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + \ No newline at end of file diff --git a/samples/client/petstore/java/feign/src/test/resources/pet.json b/samples/client/petstore/java/feign/src/test/resources/pet.json new file mode 100644 index 00000000000..4f2876a1031 --- /dev/null +++ b/samples/client/petstore/java/feign/src/test/resources/pet.json @@ -0,0 +1,18 @@ +{ + "id": 85, + "category": { + "id": 1, + "name": "Dogs" + }, + "name": "LvRcat", + "photoUrls": [ + "string" + ], + "tags": [ + { + "id": 10, + "name": "tag" + } + ], + "status": "available" +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign/src/test/resources/pet_list.json b/samples/client/petstore/java/feign/src/test/resources/pet_list.json new file mode 100644 index 00000000000..da340e03c7c --- /dev/null +++ b/samples/client/petstore/java/feign/src/test/resources/pet_list.json @@ -0,0 +1,38 @@ +[ + { + "id": 85, + "category": { + "id": 1, + "name": "Dogs" + }, + "name": "LvRcat", + "photoUrls": [ + "string" + ], + "tags": [ + { + "id": 10, + "name": "tag" + } + ], + "status": "available" + }, + { + "id": 42, + "category": { + "id": 1, + "name": "Dogs" + }, + "name": "Louise", + "photoUrls": [ + "photo" + ], + "tags": [ + { + "id": 0, + "name": "obedient" + } + ], + "status": "sold" + } +] \ No newline at end of file From 2bd4febd281df9013402eb00f68df29761764f96 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sat, 23 Jan 2021 10:34:06 +0800 Subject: [PATCH 17/54] update gradlew, gradlew.bat (#8469) --- .../openapi-generator-gradle-plugin/gradlew | 33 +++++++++---------- .../gradlew.bat | 27 +++++---------- 2 files changed, 23 insertions(+), 37 deletions(-) diff --git a/modules/openapi-generator-gradle-plugin/gradlew b/modules/openapi-generator-gradle-plugin/gradlew index 83f2acfdc31..dff5c7d9402 100755 --- a/modules/openapi-generator-gradle-plugin/gradlew +++ b/modules/openapi-generator-gradle-plugin/gradlew @@ -44,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -175,14 +177,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/modules/openapi-generator-gradle-plugin/gradlew.bat b/modules/openapi-generator-gradle-plugin/gradlew.bat index 9618d8d9607..6a68175eb70 100644 --- a/modules/openapi-generator-gradle-plugin/gradlew.bat +++ b/modules/openapi-generator-gradle-plugin/gradlew.bat @@ -29,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell From ac59ab920179484e0cf1794c74bbf3d50522e580 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sat, 23 Jan 2021 10:34:26 +0800 Subject: [PATCH 18/54] Update parser to newer version 2.0.24 (#8494) * update parser to 2.0.24 * update tests --- .../test/java/org/openapitools/codegen/DefaultCodegenTest.java | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index 7042e13c2a7..0114c9daa89 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -695,7 +695,7 @@ public class DefaultCodegenTest { CodegenParameter codegenParameter2 = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER); codegen.setParameterExampleValue(codegenParameter2, operation2.getParameters().get(0)); - Assert.assertEquals(codegenParameter2.example, "example3: parameter value"); + Assert.assertEquals(codegenParameter2.example, "An example3 value"); } @Test diff --git a/pom.xml b/pom.xml index 1213adf3b32..d30f231e13d 100644 --- a/pom.xml +++ b/pom.xml @@ -1534,7 +1534,7 @@ 1.8 2.1.2 io.swagger.parser.v3 - 2.0.23 + 2.0.24 3.3.1 2.4 1.2 From eecd30c2dab2304b39134ebfc3e5e48e74db6ff5 Mon Sep 17 00:00:00 2001 From: Frank Lehmann <11268968+fl034@users.noreply.github.com> Date: Sat, 23 Jan 2021 03:35:37 +0100 Subject: [PATCH 19/54] [swift5] Fix target SDKs for Combine option (#8476) * Update min sdks when Combine is used * Update samples * Revert "Update min sdks when Combine is used" This reverts commit e88b8abaa787ebf8cffc6b8360ea22437ae20069. * Wrap import combine with canImport directive * Update samples * Wrap functions using Combine with canImport because of compiler error on archive * Update samples * Remove unnecessary newline and update samles --- .../src/main/resources/swift5/api.mustache | 6 +++- .../OpenAPIs/AlamofireImplementations.swift | 8 ++--- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 4 +++ .../Classes/OpenAPIs/APIs/FakeAPI.swift | 26 ++++++++++++++ .../APIs/FakeClassnameTags123API.swift | 4 +++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 20 +++++++++++ .../Classes/OpenAPIs/APIs/StoreAPI.swift | 10 ++++++ .../Classes/OpenAPIs/APIs/UserAPI.swift | 18 ++++++++++ .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../default/SwaggerClientTests/Podfile.lock | 2 +- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- 30 files changed, 309 insertions(+), 223 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift5/api.mustache b/modules/openapi-generator/src/main/resources/swift5/api.mustache index 18d3e6b3045..29fe27d9f76 100644 --- a/modules/openapi-generator/src/main/resources/swift5/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/api.mustache @@ -8,7 +8,9 @@ import Foundation{{#usePromiseKit}} import PromiseKit{{/usePromiseKit}}{{#useRxSwift}} import RxSwift{{/useRxSwift}}{{#useCombine}} -import Combine{{/useCombine}}{{#swiftUseApiNamespace}} +#if canImport(Combine) +import Combine +#endif{{/useCombine}}{{#swiftUseApiNamespace}} extension {{projectName}}API { {{/swiftUseApiNamespace}} @@ -143,6 +145,7 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> AnyPublisher<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> { return Future<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error>.init { promise in @@ -162,6 +165,7 @@ extension {{projectName}}API { } }.eraseToAnyPublisher() } + #endif {{/useCombine}} {{#useResult}} /** diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift index a92b70c427b..f26fae21f71 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -9,11 +9,11 @@ import Alamofire class AlamofireRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - AlamofireRequestBuilder.self + return AlamofireRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - AlamofireDecodableRequestBuilder.self + return AlamofireDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class AlamofireRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** @@ -73,7 +73,7 @@ open class AlamofireRequestBuilder: RequestBuilder { configuration (e.g. to override the cache policy). */ open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) -> DataRequest { - manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers) + return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers) } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, Error>) -> Void) { diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3..93ed6b90b37 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index f846096ae63..62f1ed59042 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class AnotherFakeAPI { /** @@ -16,6 +18,7 @@ open class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -29,6 +32,7 @@ open class AnotherFakeAPI { } }.eraseToAnyPublisher() } + #endif /** To test special tags diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 34fa51403b6..b90460ea41a 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class FakeAPI { /** @@ -15,6 +17,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -28,6 +31,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - POST /fake/outer/boolean @@ -59,6 +63,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -72,6 +77,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - POST /fake/outer/composite @@ -103,6 +109,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -116,6 +123,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - POST /fake/outer/number @@ -147,6 +155,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -160,6 +169,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - POST /fake/outer/string @@ -191,6 +201,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -204,6 +215,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - PUT /fake/body-with-file-schema @@ -236,6 +248,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -249,6 +262,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - PUT /fake/body-with-query-params @@ -284,6 +298,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -297,6 +312,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** To test \"client\" model @@ -343,6 +359,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -356,6 +373,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -497,6 +515,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -510,6 +529,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** To test enum parameters @@ -569,6 +589,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -582,6 +603,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** Fake endpoint to test group parameters (optional) @@ -627,6 +649,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -640,6 +663,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** test inline additionalProperties @@ -673,6 +697,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -686,6 +711,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** test json serialization of form data diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index f6b896887ef..42d6ea597b4 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class FakeClassnameTags123API { /** @@ -16,6 +18,7 @@ open class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -29,6 +32,7 @@ open class FakeClassnameTags123API { } }.eraseToAnyPublisher() } + #endif /** To test class name in snake case diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 01b5812ecf3..5e27397f6fd 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class PetAPI { /** @@ -16,6 +18,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -29,6 +32,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Add a new pet to the store @@ -65,6 +69,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -78,6 +83,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Deletes a pet @@ -126,6 +132,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher<[Pet], Error> */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[Pet], Error> { return Future<[Pet], Error>.init { promise in @@ -139,6 +146,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Finds Pets by status @@ -179,6 +187,7 @@ open class PetAPI { - returns: AnyPublisher<[Pet], Error> */ @available(*, deprecated, message: "This operation is deprecated.") + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[Pet], Error> { return Future<[Pet], Error>.init { promise in @@ -192,6 +201,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Finds Pets by tags @@ -232,6 +242,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -245,6 +256,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Find pet by ID @@ -284,6 +296,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -297,6 +310,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Update an existing pet @@ -334,6 +348,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -347,6 +362,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Updates a pet in the store with form data @@ -395,6 +411,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -408,6 +425,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** uploads an image @@ -456,6 +474,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -469,6 +488,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** uploads an image (required) diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index c3499823631..b50dcb0193c 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class StoreAPI { /** @@ -16,6 +18,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -29,6 +32,7 @@ open class StoreAPI { } }.eraseToAnyPublisher() } + #endif /** Delete purchase order by ID @@ -64,6 +68,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher<[String: Int], Error> */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[String: Int], Error> { return Future<[String: Int], Error>.init { promise in @@ -77,6 +82,7 @@ open class StoreAPI { } }.eraseToAnyPublisher() } + #endif /** Returns pet inventories by status @@ -112,6 +118,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -125,6 +132,7 @@ open class StoreAPI { } }.eraseToAnyPublisher() } + #endif /** Find purchase order by ID @@ -161,6 +169,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -174,6 +183,7 @@ open class StoreAPI { } }.eraseToAnyPublisher() } + #endif /** Place an order for a pet diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 9df08496cc2..f678057ceaf 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class UserAPI { /** @@ -16,6 +18,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -29,6 +32,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Create user @@ -62,6 +66,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -75,6 +80,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Creates list of users with given input array @@ -107,6 +113,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -120,6 +127,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Creates list of users with given input array @@ -152,6 +160,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -165,6 +174,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Delete user @@ -201,6 +211,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -214,6 +225,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Get user by user name @@ -250,6 +262,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -263,6 +276,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Logs user into the system @@ -300,6 +314,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -313,6 +328,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Logs out current logged in user session @@ -345,6 +361,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -358,6 +375,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Updated user diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3..93ed6b90b37 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d..c7804d16e30 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3..93ed6b90b37 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d..c7804d16e30 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/default/SwaggerClientTests/Podfile.lock b/samples/client/petstore/swift5/default/SwaggerClientTests/Podfile.lock index a621fdeec88..11d11529e9e 100644 --- a/samples/client/petstore/swift5/default/SwaggerClientTests/Podfile.lock +++ b/samples/client/petstore/swift5/default/SwaggerClientTests/Podfile.lock @@ -13,4 +13,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 509bec696cc1d8641751b52e4fe4bef04ac4542c -COCOAPODS: 1.9.0 +COCOAPODS: 1.10.0 diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3..93ed6b90b37 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d..c7804d16e30 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift index a6a3cf54df1..e5511b3aa37 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index c9bd304a6de..a2de4751c64 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ internal class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ internal func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3..93ed6b90b37 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d..c7804d16e30 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 31bfaa0255f..736702ea5dd 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -8,35 +8,35 @@ import Foundation import PromiseKit extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -49,7 +49,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -65,32 +65,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -98,11 +98,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -175,7 +175,7 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d..c7804d16e30 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3..93ed6b90b37 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d..c7804d16e30 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3..93ed6b90b37 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d..c7804d16e30 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3..93ed6b90b37 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d..c7804d16e30 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3..93ed6b90b37 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d..c7804d16e30 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** From 96da7aaf9d09c1557c4b74c57d0a896f9e69fc64 Mon Sep 17 00:00:00 2001 From: SBNTT Date: Sat, 23 Jan 2021 03:39:21 +0100 Subject: [PATCH 20/54] --http-user-agent arg support in dart generator (#8508) * add User-Agent header * set User-Agent header only if httpUserAgent is defined * add User-Agent header in dart-dio generator * update samples --- .../src/main/resources/dart-dio/api.mustache | 3 +- .../main/resources/dart/api_client.mustache | 1 + .../petstore_client_lib/lib/api/pet_api.dart | 16 +++++----- .../lib/api/store_api.dart | 8 ++--- .../petstore_client_lib/lib/api/user_api.dart | 16 +++++----- .../petstore_client_lib/lib/api/pet_api.dart | 16 +++++----- .../lib/api/store_api.dart | 8 ++--- .../petstore_client_lib/lib/api/user_api.dart | 16 +++++----- .../lib/api/another_fake_api.dart | 2 +- .../lib/api/default_api.dart | 2 +- .../lib/api/fake_api.dart | 30 +++++++++---------- .../lib/api/fake_classname_tags123_api.dart | 2 +- .../lib/api/pet_api.dart | 18 +++++------ .../lib/api/store_api.dart | 8 ++--- .../lib/api/user_api.dart | 16 +++++----- 15 files changed, 82 insertions(+), 80 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache index 3ecff3ef146..dcfedc065ed 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache @@ -33,7 +33,8 @@ class {{classname}} { final String _path = '{{{path}}}'{{#pathParams}}.replaceAll('{' r'{{baseName}}' '}', {{{paramName}}}.toString()){{/pathParams}}; final queryParams = {}; - final headerParams = { + final headerParams = { {{#httpUserAgent}} + 'User-Agent': '{{{.}}}',{{/httpUserAgent}} if (headers != null) ...headers, }; dynamic bodyData; diff --git a/modules/openapi-generator/src/main/resources/dart/api_client.mustache b/modules/openapi-generator/src/main/resources/dart/api_client.mustache index 0e240523542..9bb3d59bc52 100644 --- a/modules/openapi-generator/src/main/resources/dart/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart/api_client.mustache @@ -23,6 +23,7 @@ class ApiClient { _authentications['{{name}}'] = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}} _authentications['{{name}}'] = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}} _authentications['{{name}}'] = new OAuth();{{/isOAuth}}{{/authMethods}} + {{#httpUserAgent}}addDefaultHeader('User-Agent', '{{{.}}}');{{/httpUserAgent}} } void addDefaultHeader(String key, String value) { diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index 795b627fb40..fe5c9299841 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -37,7 +37,7 @@ class PetApi { final String _path = '/pet'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -96,7 +96,7 @@ class PetApi { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -147,7 +147,7 @@ class PetApi { final String _path = '/pet/findByStatus'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -217,7 +217,7 @@ class PetApi { final String _path = '/pet/findByTags'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -287,7 +287,7 @@ class PetApi { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -355,7 +355,7 @@ class PetApi { final String _path = '/pet'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -415,7 +415,7 @@ class PetApi { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -475,7 +475,7 @@ class PetApi { final String _path = '/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart index ed20fd6fce5..f9a8754907a 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart @@ -34,7 +34,7 @@ class StoreApi { final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -78,7 +78,7 @@ class StoreApi { final String _path = '/store/inventory'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -149,7 +149,7 @@ class StoreApi { final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -210,7 +210,7 @@ class StoreApi { final String _path = '/store/order'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart index fc504efe821..17b551bc911 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart @@ -34,7 +34,7 @@ class UserApi { final String _path = '/user'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -84,7 +84,7 @@ class UserApi { final String _path = '/user/createWithArray'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -134,7 +134,7 @@ class UserApi { final String _path = '/user/createWithList'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -184,7 +184,7 @@ class UserApi { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -229,7 +229,7 @@ class UserApi { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -291,7 +291,7 @@ class UserApi { final String _path = '/user/login'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -349,7 +349,7 @@ class UserApi { final String _path = '/user/logout'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -395,7 +395,7 @@ class UserApi { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index f91d7d0125a..95db7626674 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -37,7 +37,7 @@ class PetApi { final String _path = '/pet'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -112,7 +112,7 @@ class PetApi { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -163,7 +163,7 @@ class PetApi { final String _path = '/pet/findByStatus'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -233,7 +233,7 @@ class PetApi { final String _path = '/pet/findByTags'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -303,7 +303,7 @@ class PetApi { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -371,7 +371,7 @@ class PetApi { final String _path = '/pet'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -447,7 +447,7 @@ class PetApi { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -507,7 +507,7 @@ class PetApi { final String _path = '/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart index ba3f241333e..5f58e788091 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart @@ -34,7 +34,7 @@ class StoreApi { final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -78,7 +78,7 @@ class StoreApi { final String _path = '/store/inventory'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -149,7 +149,7 @@ class StoreApi { final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -210,7 +210,7 @@ class StoreApi { final String _path = '/store/order'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart index cb890e1846c..a4d59b2978c 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart @@ -34,7 +34,7 @@ class UserApi { final String _path = '/user'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -93,7 +93,7 @@ class UserApi { final String _path = '/user/createWithArray'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -152,7 +152,7 @@ class UserApi { final String _path = '/user/createWithList'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -211,7 +211,7 @@ class UserApi { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -263,7 +263,7 @@ class UserApi { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -325,7 +325,7 @@ class UserApi { final String _path = '/user/login'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -383,7 +383,7 @@ class UserApi { final String _path = '/user/logout'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -436,7 +436,7 @@ class UserApi { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart index 16e34300387..72310ff3533 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -33,7 +33,7 @@ class AnotherFakeApi { final String _path = '/another-fake/dummy'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart index 1e93ce8718a..a47b383960b 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart @@ -32,7 +32,7 @@ class DefaultApi { final String _path = '/foo'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart index 95dd5da583d..96d776d36f9 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart @@ -40,7 +40,7 @@ class FakeApi { final String _path = '/fake/health'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -103,7 +103,7 @@ class FakeApi { final String _path = '/fake/http-signature-test'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -163,7 +163,7 @@ class FakeApi { final String _path = '/fake/outer/boolean'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -226,7 +226,7 @@ class FakeApi { final String _path = '/fake/outer/composite'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -294,7 +294,7 @@ class FakeApi { final String _path = '/fake/outer/number'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -357,7 +357,7 @@ class FakeApi { final String _path = '/fake/outer/string'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -420,7 +420,7 @@ class FakeApi { final String _path = '/fake/body-with-file-schema'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -473,7 +473,7 @@ class FakeApi { final String _path = '/fake/body-with-query-params'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -526,7 +526,7 @@ class FakeApi { final String _path = '/fake'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -607,7 +607,7 @@ class FakeApi { final String _path = '/fake'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -684,7 +684,7 @@ class FakeApi { final String _path = '/fake'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -748,7 +748,7 @@ class FakeApi { final String _path = '/fake'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -804,7 +804,7 @@ class FakeApi { final String _path = '/fake/inline-additionalProperties'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -857,7 +857,7 @@ class FakeApi { final String _path = '/fake/jsonFormData'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -914,7 +914,7 @@ class FakeApi { final String _path = '/fake/test-query-paramters'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart index 222097970a1..81d1c554818 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -33,7 +33,7 @@ class FakeClassnameTags123Api { final String _path = '/fake_classname_test'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart index 4572f3c2a0d..6bb8363f2ae 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart @@ -37,7 +37,7 @@ class PetApi { final String _path = '/pet'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -96,7 +96,7 @@ class PetApi { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -147,7 +147,7 @@ class PetApi { final String _path = '/pet/findByStatus'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -217,7 +217,7 @@ class PetApi { final String _path = '/pet/findByTags'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -287,7 +287,7 @@ class PetApi { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -355,7 +355,7 @@ class PetApi { final String _path = '/pet'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -415,7 +415,7 @@ class PetApi { final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -475,7 +475,7 @@ class PetApi { final String _path = '/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -551,7 +551,7 @@ class PetApi { final String _path = '/fake/{petId}/uploadImageWithRequiredFile'.replaceAll('{' r'petId' '}', petId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart index a1bea34d14f..b9be3d2f72d 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart @@ -34,7 +34,7 @@ class StoreApi { final String _path = '/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -78,7 +78,7 @@ class StoreApi { final String _path = '/store/inventory'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -149,7 +149,7 @@ class StoreApi { final String _path = '/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -210,7 +210,7 @@ class StoreApi { final String _path = '/store/order'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart index 87dbb0b8d14..e73986ac493 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart @@ -34,7 +34,7 @@ class UserApi { final String _path = '/user'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -86,7 +86,7 @@ class UserApi { final String _path = '/user/createWithArray'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -138,7 +138,7 @@ class UserApi { final String _path = '/user/createWithList'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -190,7 +190,7 @@ class UserApi { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -235,7 +235,7 @@ class UserApi { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -297,7 +297,7 @@ class UserApi { final String _path = '/user/login'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -355,7 +355,7 @@ class UserApi { final String _path = '/user/logout'; final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; @@ -401,7 +401,7 @@ class UserApi { final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString()); final queryParams = {}; - final headerParams = { + final headerParams = { if (headers != null) ...headers, }; dynamic bodyData; From 030b75b0125161ed847da59367c75e79b63d3afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20C=C3=B4t=C3=A9?= Date: Fri, 22 Jan 2021 21:58:36 -0500 Subject: [PATCH 21/54] [Play Framework] Update the bean validation to use version 2.0. (#8354) * Update the bean validation to use version 2.0. For a reason I don't know, it was not working anymore with version 1. * better format Co-authored-by: William Cheng --- .../JavaPlayFramework/beanValidation.mustache | 2 +- .../JavaPlayFramework/build.mustache | 2 +- .../resources/JavaPlayFramework/pojo.mustache | 10 ++- .../app/apimodels/Category.java | 6 +- .../app/apimodels/ModelApiResponse.java | 9 +- .../app/apimodels/Order.java | 18 ++-- .../app/apimodels/Pet.java | 18 ++-- .../app/apimodels/Tag.java | 6 +- .../app/apimodels/User.java | 24 +++-- .../build.sbt | 2 +- .../app/apimodels/Category.java | 6 +- .../app/apimodels/ModelApiResponse.java | 9 +- .../app/apimodels/Order.java | 18 ++-- .../app/apimodels/Pet.java | 18 ++-- .../app/apimodels/Tag.java | 6 +- .../app/apimodels/User.java | 24 +++-- .../java-play-framework-async/build.sbt | 2 +- .../app/apimodels/Category.java | 6 +- .../app/apimodels/ModelApiResponse.java | 9 +- .../app/apimodels/Order.java | 18 ++-- .../app/apimodels/Pet.java | 18 ++-- .../app/apimodels/Tag.java | 6 +- .../app/apimodels/User.java | 24 +++-- .../build.sbt | 2 +- .../AdditionalPropertiesAnyType.java | 3 +- .../apimodels/AdditionalPropertiesArray.java | 3 +- .../AdditionalPropertiesBoolean.java | 3 +- .../apimodels/AdditionalPropertiesClass.java | 33 ++++--- .../AdditionalPropertiesInteger.java | 3 +- .../apimodels/AdditionalPropertiesNumber.java | 3 +- .../apimodels/AdditionalPropertiesObject.java | 3 +- .../apimodels/AdditionalPropertiesString.java | 3 +- .../app/apimodels/Animal.java | 6 +- .../apimodels/ArrayOfArrayOfNumberOnly.java | 3 +- .../app/apimodels/ArrayOfNumberOnly.java | 3 +- .../app/apimodels/ArrayTest.java | 9 +- .../app/apimodels/BigCat.java | 3 +- .../app/apimodels/BigCatAllOf.java | 3 +- .../app/apimodels/Capitalization.java | 18 ++-- .../app/apimodels/Cat.java | 3 +- .../app/apimodels/CatAllOf.java | 3 +- .../app/apimodels/Category.java | 6 +- .../app/apimodels/ClassModel.java | 3 +- .../app/apimodels/Client.java | 3 +- .../app/apimodels/Dog.java | 3 +- .../app/apimodels/DogAllOf.java | 3 +- .../app/apimodels/EnumArrays.java | 6 +- .../app/apimodels/EnumTest.java | 15 ++-- .../app/apimodels/FileSchemaTestClass.java | 6 +- .../app/apimodels/FormatTest.java | 62 ++++++++----- .../app/apimodels/HasOnlyReadOnly.java | 6 +- .../app/apimodels/MapTest.java | 12 ++- ...ropertiesAndAdditionalPropertiesClass.java | 9 +- .../app/apimodels/Model200Response.java | 6 +- .../app/apimodels/ModelApiResponse.java | 9 +- .../app/apimodels/ModelReturn.java | 3 +- .../app/apimodels/Name.java | 12 ++- .../app/apimodels/NumberOnly.java | 3 +- .../app/apimodels/Order.java | 18 ++-- .../app/apimodels/OuterComposite.java | 9 +- .../app/apimodels/Pet.java | 18 ++-- .../app/apimodels/ReadOnlyFirst.java | 6 +- .../app/apimodels/SpecialModelName.java | 3 +- .../app/apimodels/Tag.java | 6 +- .../app/apimodels/TypeHolderDefault.java | 17 ++-- .../app/apimodels/TypeHolderExample.java | 20 +++-- .../app/apimodels/User.java | 24 +++-- .../app/apimodels/XmlItem.java | 87 ++++++++++++------- .../build.sbt | 2 +- .../app/apimodels/Category.java | 4 +- .../app/apimodels/ModelApiResponse.java | 6 +- .../app/apimodels/Order.java | 12 +-- .../app/apimodels/Pet.java | 12 +-- .../app/apimodels/Tag.java | 4 +- .../app/apimodels/User.java | 16 ++-- .../app/apimodels/Category.java | 6 +- .../app/apimodels/ModelApiResponse.java | 9 +- .../app/apimodels/Order.java | 18 ++-- .../app/apimodels/Pet.java | 18 ++-- .../app/apimodels/Tag.java | 6 +- .../app/apimodels/User.java | 24 +++-- .../build.sbt | 2 +- .../app/apimodels/Category.java | 6 +- .../app/apimodels/ModelApiResponse.java | 9 +- .../app/apimodels/Order.java | 18 ++-- .../app/apimodels/Pet.java | 18 ++-- .../app/apimodels/Tag.java | 6 +- .../app/apimodels/User.java | 24 +++-- .../build.sbt | 2 +- .../app/apimodels/Category.java | 6 +- .../app/apimodels/ModelApiResponse.java | 9 +- .../app/apimodels/Order.java | 18 ++-- .../app/apimodels/Pet.java | 18 ++-- .../app/apimodels/Tag.java | 6 +- .../app/apimodels/User.java | 24 +++-- .../java-play-framework-no-nullable/build.sbt | 2 +- .../app/apimodels/Category.java | 6 +- .../app/apimodels/ModelApiResponse.java | 9 +- .../app/apimodels/Order.java | 18 ++-- .../app/apimodels/Pet.java | 18 ++-- .../app/apimodels/Tag.java | 6 +- .../app/apimodels/User.java | 24 +++-- .../build.sbt | 2 +- .../app/apimodels/Category.java | 6 +- .../app/apimodels/ModelApiResponse.java | 9 +- .../app/apimodels/Order.java | 18 ++-- .../app/apimodels/Pet.java | 18 ++-- .../app/apimodels/Tag.java | 6 +- .../app/apimodels/User.java | 24 +++-- .../build.sbt | 2 +- .../app/apimodels/Category.java | 6 +- .../app/apimodels/ModelApiResponse.java | 9 +- .../app/apimodels/Order.java | 18 ++-- .../app/apimodels/Pet.java | 18 ++-- .../app/apimodels/Tag.java | 6 +- .../app/apimodels/User.java | 24 +++-- .../petstore/java-play-framework/build.sbt | 2 +- 117 files changed, 849 insertions(+), 448 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaPlayFramework/beanValidation.mustache b/modules/openapi-generator/src/main/resources/JavaPlayFramework/beanValidation.mustache index 56b047acef0..978069fbeec 100644 --- a/modules/openapi-generator/src/main/resources/JavaPlayFramework/beanValidation.mustache +++ b/modules/openapi-generator/src/main/resources/JavaPlayFramework/beanValidation.mustache @@ -53,4 +53,4 @@ {{/isInteger}} {{^isPrimitiveType}} @Valid -{{/isPrimitiveType}} +{{/isPrimitiveType}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaPlayFramework/build.mustache b/modules/openapi-generator/src/main/resources/JavaPlayFramework/build.mustache index 379521797a2..df0dace75ba 100644 --- a/modules/openapi-generator/src/main/resources/JavaPlayFramework/build.mustache +++ b/modules/openapi-generator/src/main/resources/JavaPlayFramework/build.mustache @@ -10,6 +10,6 @@ scalaVersion := "2.12.6" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5" {{/useSwaggerUI}} {{#useBeanValidation}} -libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" +libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final" {{/useBeanValidation}} libraryDependencies += guice diff --git a/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache index 8eb2397060e..d25b2b8be69 100644 --- a/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache @@ -26,9 +26,15 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali @SerializedName("{{baseName}}") {{/gson}} {{#isContainer}} + {{#useBeanValidation}} + {{>beanValidation}} + {{/useBeanValidation}} private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} + {{#useBeanValidation}} + {{>beanValidation}} + {{/useBeanValidation}} private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} @@ -78,10 +84,10 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali {{/maximum}} * @return {{name}} **/ - {{#vendorExtensions.x-extra-annotation}} + {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} {{/vendorExtensions.x-extra-annotation}} - {{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} public {{{datatypeWithEnum}}} {{getter}}() { + public {{{datatypeWithEnum}}} {{getter}}() { return {{name}}; } diff --git a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Category.java index c6f15ca13c3..afed4d545a9 100644 --- a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Category.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Category id(Long id) { @@ -26,7 +28,7 @@ public class Category { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Category { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/ModelApiResponse.java index b99eabed6fd..820779a1cd9 100644 --- a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/ModelApiResponse.java @@ -12,12 +12,15 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") + private Integer code; @JsonProperty("type") + private String type; @JsonProperty("message") + private String message; public ModelApiResponse code(Integer code) { @@ -29,7 +32,7 @@ public class ModelApiResponse { * Get code * @return code **/ - public Integer getCode() { + public Integer getCode() { return code; } @@ -46,7 +49,7 @@ public class ModelApiResponse { * Get type * @return type **/ - public String getType() { + public String getType() { return type; } @@ -63,7 +66,7 @@ public class ModelApiResponse { * Get message * @return message **/ - public String getMessage() { + public String getMessage() { return message; } diff --git a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Order.java index 2d378562807..d54cba148ad 100644 --- a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Order.java @@ -13,15 +13,20 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") + private Long id; @JsonProperty("petId") + private Long petId; @JsonProperty("quantity") + private Integer quantity; @JsonProperty("shipDate") + @Valid + private OffsetDateTime shipDate; /** @@ -58,9 +63,11 @@ public class Order { } @JsonProperty("status") + private StatusEnum status; @JsonProperty("complete") + private Boolean complete = false; public Order id(Long id) { @@ -72,7 +79,7 @@ public class Order { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -89,7 +96,7 @@ public class Order { * Get petId * @return petId **/ - public Long getPetId() { + public Long getPetId() { return petId; } @@ -106,7 +113,7 @@ public class Order { * Get quantity * @return quantity **/ - public Integer getQuantity() { + public Integer getQuantity() { return quantity; } @@ -123,7 +130,6 @@ public class Order { * Get shipDate * @return shipDate **/ - @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -141,7 +147,7 @@ public class Order { * Order Status * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } @@ -158,7 +164,7 @@ public class Order { * Get complete * @return complete **/ - public Boolean getComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Pet.java index f6c95ac4e9e..4699f7235ed 100644 --- a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Pet.java @@ -16,18 +16,27 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") + private Long id; @JsonProperty("category") + @Valid + private Category category; @JsonProperty("name") + @NotNull + private String name; @JsonProperty("photoUrls") + @NotNull + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") + @Valid + private List tags = null; /** @@ -64,6 +73,7 @@ public class Pet { } @JsonProperty("status") + private StatusEnum status; public Pet id(Long id) { @@ -75,7 +85,7 @@ public class Pet { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -92,7 +102,6 @@ public class Pet { * Get category * @return category **/ - @Valid public Category getCategory() { return category; } @@ -110,7 +119,6 @@ public class Pet { * Get name * @return name **/ - @NotNull public String getName() { return name; } @@ -133,7 +141,6 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - @NotNull public List getPhotoUrls() { return photoUrls; } @@ -159,7 +166,6 @@ public class Pet { * Get tags * @return tags **/ - @Valid public List getTags() { return tags; } @@ -177,7 +183,7 @@ public class Pet { * pet status in the store * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Tag.java index 47799f61395..adac882cd05 100644 --- a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/Tag.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Tag id(Long id) { @@ -26,7 +28,7 @@ public class Tag { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Tag { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/User.java b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/User.java index dc119d03edf..4e5d397b990 100644 --- a/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-api-package-override/app/apimodels/User.java @@ -12,27 +12,35 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") + private Long id; @JsonProperty("username") + private String username; @JsonProperty("firstName") + private String firstName; @JsonProperty("lastName") + private String lastName; @JsonProperty("email") + private String email; @JsonProperty("password") + private String password; @JsonProperty("phone") + private String phone; @JsonProperty("userStatus") + private Integer userStatus; public User id(Long id) { @@ -44,7 +52,7 @@ public class User { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -61,7 +69,7 @@ public class User { * Get username * @return username **/ - public String getUsername() { + public String getUsername() { return username; } @@ -78,7 +86,7 @@ public class User { * Get firstName * @return firstName **/ - public String getFirstName() { + public String getFirstName() { return firstName; } @@ -95,7 +103,7 @@ public class User { * Get lastName * @return lastName **/ - public String getLastName() { + public String getLastName() { return lastName; } @@ -112,7 +120,7 @@ public class User { * Get email * @return email **/ - public String getEmail() { + public String getEmail() { return email; } @@ -129,7 +137,7 @@ public class User { * Get password * @return password **/ - public String getPassword() { + public String getPassword() { return password; } @@ -146,7 +154,7 @@ public class User { * Get phone * @return phone **/ - public String getPhone() { + public String getPhone() { return phone; } @@ -163,7 +171,7 @@ public class User { * User Status * @return userStatus **/ - public Integer getUserStatus() { + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/java-play-framework-api-package-override/build.sbt b/samples/server/petstore/java-play-framework-api-package-override/build.sbt index 83a17e91013..b972893fc3f 100644 --- a/samples/server/petstore/java-play-framework-api-package-override/build.sbt +++ b/samples/server/petstore/java-play-framework-api-package-override/build.sbt @@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.12.6" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5" -libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" +libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final" libraryDependencies += guice diff --git a/samples/server/petstore/java-play-framework-async/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-async/app/apimodels/Category.java index c6f15ca13c3..afed4d545a9 100644 --- a/samples/server/petstore/java-play-framework-async/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-async/app/apimodels/Category.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Category id(Long id) { @@ -26,7 +28,7 @@ public class Category { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Category { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-async/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-async/app/apimodels/ModelApiResponse.java index b99eabed6fd..820779a1cd9 100644 --- a/samples/server/petstore/java-play-framework-async/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-async/app/apimodels/ModelApiResponse.java @@ -12,12 +12,15 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") + private Integer code; @JsonProperty("type") + private String type; @JsonProperty("message") + private String message; public ModelApiResponse code(Integer code) { @@ -29,7 +32,7 @@ public class ModelApiResponse { * Get code * @return code **/ - public Integer getCode() { + public Integer getCode() { return code; } @@ -46,7 +49,7 @@ public class ModelApiResponse { * Get type * @return type **/ - public String getType() { + public String getType() { return type; } @@ -63,7 +66,7 @@ public class ModelApiResponse { * Get message * @return message **/ - public String getMessage() { + public String getMessage() { return message; } diff --git a/samples/server/petstore/java-play-framework-async/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-async/app/apimodels/Order.java index 2d378562807..d54cba148ad 100644 --- a/samples/server/petstore/java-play-framework-async/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-async/app/apimodels/Order.java @@ -13,15 +13,20 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") + private Long id; @JsonProperty("petId") + private Long petId; @JsonProperty("quantity") + private Integer quantity; @JsonProperty("shipDate") + @Valid + private OffsetDateTime shipDate; /** @@ -58,9 +63,11 @@ public class Order { } @JsonProperty("status") + private StatusEnum status; @JsonProperty("complete") + private Boolean complete = false; public Order id(Long id) { @@ -72,7 +79,7 @@ public class Order { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -89,7 +96,7 @@ public class Order { * Get petId * @return petId **/ - public Long getPetId() { + public Long getPetId() { return petId; } @@ -106,7 +113,7 @@ public class Order { * Get quantity * @return quantity **/ - public Integer getQuantity() { + public Integer getQuantity() { return quantity; } @@ -123,7 +130,6 @@ public class Order { * Get shipDate * @return shipDate **/ - @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -141,7 +147,7 @@ public class Order { * Order Status * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } @@ -158,7 +164,7 @@ public class Order { * Get complete * @return complete **/ - public Boolean getComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-play-framework-async/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-async/app/apimodels/Pet.java index f6c95ac4e9e..4699f7235ed 100644 --- a/samples/server/petstore/java-play-framework-async/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-async/app/apimodels/Pet.java @@ -16,18 +16,27 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") + private Long id; @JsonProperty("category") + @Valid + private Category category; @JsonProperty("name") + @NotNull + private String name; @JsonProperty("photoUrls") + @NotNull + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") + @Valid + private List tags = null; /** @@ -64,6 +73,7 @@ public class Pet { } @JsonProperty("status") + private StatusEnum status; public Pet id(Long id) { @@ -75,7 +85,7 @@ public class Pet { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -92,7 +102,6 @@ public class Pet { * Get category * @return category **/ - @Valid public Category getCategory() { return category; } @@ -110,7 +119,6 @@ public class Pet { * Get name * @return name **/ - @NotNull public String getName() { return name; } @@ -133,7 +141,6 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - @NotNull public List getPhotoUrls() { return photoUrls; } @@ -159,7 +166,6 @@ public class Pet { * Get tags * @return tags **/ - @Valid public List getTags() { return tags; } @@ -177,7 +183,7 @@ public class Pet { * pet status in the store * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/java-play-framework-async/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-async/app/apimodels/Tag.java index 47799f61395..adac882cd05 100644 --- a/samples/server/petstore/java-play-framework-async/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-async/app/apimodels/Tag.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Tag id(Long id) { @@ -26,7 +28,7 @@ public class Tag { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Tag { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-async/app/apimodels/User.java b/samples/server/petstore/java-play-framework-async/app/apimodels/User.java index dc119d03edf..4e5d397b990 100644 --- a/samples/server/petstore/java-play-framework-async/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-async/app/apimodels/User.java @@ -12,27 +12,35 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") + private Long id; @JsonProperty("username") + private String username; @JsonProperty("firstName") + private String firstName; @JsonProperty("lastName") + private String lastName; @JsonProperty("email") + private String email; @JsonProperty("password") + private String password; @JsonProperty("phone") + private String phone; @JsonProperty("userStatus") + private Integer userStatus; public User id(Long id) { @@ -44,7 +52,7 @@ public class User { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -61,7 +69,7 @@ public class User { * Get username * @return username **/ - public String getUsername() { + public String getUsername() { return username; } @@ -78,7 +86,7 @@ public class User { * Get firstName * @return firstName **/ - public String getFirstName() { + public String getFirstName() { return firstName; } @@ -95,7 +103,7 @@ public class User { * Get lastName * @return lastName **/ - public String getLastName() { + public String getLastName() { return lastName; } @@ -112,7 +120,7 @@ public class User { * Get email * @return email **/ - public String getEmail() { + public String getEmail() { return email; } @@ -129,7 +137,7 @@ public class User { * Get password * @return password **/ - public String getPassword() { + public String getPassword() { return password; } @@ -146,7 +154,7 @@ public class User { * Get phone * @return phone **/ - public String getPhone() { + public String getPhone() { return phone; } @@ -163,7 +171,7 @@ public class User { * User Status * @return userStatus **/ - public Integer getUserStatus() { + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/java-play-framework-async/build.sbt b/samples/server/petstore/java-play-framework-async/build.sbt index 83a17e91013..b972893fc3f 100644 --- a/samples/server/petstore/java-play-framework-async/build.sbt +++ b/samples/server/petstore/java-play-framework-async/build.sbt @@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.12.6" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5" -libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" +libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final" libraryDependencies += guice diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Category.java index c6f15ca13c3..afed4d545a9 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Category.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Category id(Long id) { @@ -26,7 +28,7 @@ public class Category { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Category { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/ModelApiResponse.java index b99eabed6fd..820779a1cd9 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/ModelApiResponse.java @@ -12,12 +12,15 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") + private Integer code; @JsonProperty("type") + private String type; @JsonProperty("message") + private String message; public ModelApiResponse code(Integer code) { @@ -29,7 +32,7 @@ public class ModelApiResponse { * Get code * @return code **/ - public Integer getCode() { + public Integer getCode() { return code; } @@ -46,7 +49,7 @@ public class ModelApiResponse { * Get type * @return type **/ - public String getType() { + public String getType() { return type; } @@ -63,7 +66,7 @@ public class ModelApiResponse { * Get message * @return message **/ - public String getMessage() { + public String getMessage() { return message; } diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Order.java index 2d378562807..d54cba148ad 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Order.java @@ -13,15 +13,20 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") + private Long id; @JsonProperty("petId") + private Long petId; @JsonProperty("quantity") + private Integer quantity; @JsonProperty("shipDate") + @Valid + private OffsetDateTime shipDate; /** @@ -58,9 +63,11 @@ public class Order { } @JsonProperty("status") + private StatusEnum status; @JsonProperty("complete") + private Boolean complete = false; public Order id(Long id) { @@ -72,7 +79,7 @@ public class Order { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -89,7 +96,7 @@ public class Order { * Get petId * @return petId **/ - public Long getPetId() { + public Long getPetId() { return petId; } @@ -106,7 +113,7 @@ public class Order { * Get quantity * @return quantity **/ - public Integer getQuantity() { + public Integer getQuantity() { return quantity; } @@ -123,7 +130,6 @@ public class Order { * Get shipDate * @return shipDate **/ - @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -141,7 +147,7 @@ public class Order { * Order Status * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } @@ -158,7 +164,7 @@ public class Order { * Get complete * @return complete **/ - public Boolean getComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Pet.java index f6c95ac4e9e..4699f7235ed 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Pet.java @@ -16,18 +16,27 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") + private Long id; @JsonProperty("category") + @Valid + private Category category; @JsonProperty("name") + @NotNull + private String name; @JsonProperty("photoUrls") + @NotNull + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") + @Valid + private List tags = null; /** @@ -64,6 +73,7 @@ public class Pet { } @JsonProperty("status") + private StatusEnum status; public Pet id(Long id) { @@ -75,7 +85,7 @@ public class Pet { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -92,7 +102,6 @@ public class Pet { * Get category * @return category **/ - @Valid public Category getCategory() { return category; } @@ -110,7 +119,6 @@ public class Pet { * Get name * @return name **/ - @NotNull public String getName() { return name; } @@ -133,7 +141,6 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - @NotNull public List getPhotoUrls() { return photoUrls; } @@ -159,7 +166,6 @@ public class Pet { * Get tags * @return tags **/ - @Valid public List getTags() { return tags; } @@ -177,7 +183,7 @@ public class Pet { * pet status in the store * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Tag.java index 47799f61395..adac882cd05 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Tag.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Tag id(Long id) { @@ -26,7 +28,7 @@ public class Tag { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Tag { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/User.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/User.java index dc119d03edf..4e5d397b990 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/User.java @@ -12,27 +12,35 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") + private Long id; @JsonProperty("username") + private String username; @JsonProperty("firstName") + private String firstName; @JsonProperty("lastName") + private String lastName; @JsonProperty("email") + private String email; @JsonProperty("password") + private String password; @JsonProperty("phone") + private String phone; @JsonProperty("userStatus") + private Integer userStatus; public User id(Long id) { @@ -44,7 +52,7 @@ public class User { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -61,7 +69,7 @@ public class User { * Get username * @return username **/ - public String getUsername() { + public String getUsername() { return username; } @@ -78,7 +86,7 @@ public class User { * Get firstName * @return firstName **/ - public String getFirstName() { + public String getFirstName() { return firstName; } @@ -95,7 +103,7 @@ public class User { * Get lastName * @return lastName **/ - public String getLastName() { + public String getLastName() { return lastName; } @@ -112,7 +120,7 @@ public class User { * Get email * @return email **/ - public String getEmail() { + public String getEmail() { return email; } @@ -129,7 +137,7 @@ public class User { * Get password * @return password **/ - public String getPassword() { + public String getPassword() { return password; } @@ -146,7 +154,7 @@ public class User { * Get phone * @return phone **/ - public String getPhone() { + public String getPhone() { return phone; } @@ -163,7 +171,7 @@ public class User { * User Status * @return userStatus **/ - public Integer getUserStatus() { + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/java-play-framework-controller-only/build.sbt b/samples/server/petstore/java-play-framework-controller-only/build.sbt index 83a17e91013..b972893fc3f 100644 --- a/samples/server/petstore/java-play-framework-controller-only/build.sbt +++ b/samples/server/petstore/java-play-framework-controller-only/build.sbt @@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.12.6" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5" -libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" +libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final" libraryDependencies += guice diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesAnyType.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesAnyType.java index ef168e15d51..b0a7d76dd74 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesAnyType.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesAnyType.java @@ -14,6 +14,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class AdditionalPropertiesAnyType extends HashMap { @JsonProperty("name") + private String name; public AdditionalPropertiesAnyType name(String name) { @@ -25,7 +26,7 @@ public class AdditionalPropertiesAnyType extends HashMap { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesArray.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesArray.java index 56458c16eea..84342b61bd4 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesArray.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesArray.java @@ -15,6 +15,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class AdditionalPropertiesArray extends HashMap { @JsonProperty("name") + private String name; public AdditionalPropertiesArray name(String name) { @@ -26,7 +27,7 @@ public class AdditionalPropertiesArray extends HashMap { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesBoolean.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesBoolean.java index 7fd46035e0c..f6631c053d4 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesBoolean.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesBoolean.java @@ -14,6 +14,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class AdditionalPropertiesBoolean extends HashMap { @JsonProperty("name") + private String name; public AdditionalPropertiesBoolean name(String name) { @@ -25,7 +26,7 @@ public class AdditionalPropertiesBoolean extends HashMap { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesClass.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesClass.java index d1d4e7cf987..84ba450c960 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesClass.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesClass.java @@ -16,36 +16,52 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class AdditionalPropertiesClass { @JsonProperty("map_string") + private Map mapString = null; @JsonProperty("map_number") + @Valid + private Map mapNumber = null; @JsonProperty("map_integer") + private Map mapInteger = null; @JsonProperty("map_boolean") + private Map mapBoolean = null; @JsonProperty("map_array_integer") + @Valid + private Map> mapArrayInteger = null; @JsonProperty("map_array_anytype") + @Valid + private Map> mapArrayAnytype = null; @JsonProperty("map_map_string") + @Valid + private Map> mapMapString = null; @JsonProperty("map_map_anytype") + @Valid + private Map> mapMapAnytype = null; @JsonProperty("anytype_1") + private Object anytype1; @JsonProperty("anytype_2") + private Object anytype2; @JsonProperty("anytype_3") + private Object anytype3; public AdditionalPropertiesClass mapString(Map mapString) { @@ -65,7 +81,7 @@ public class AdditionalPropertiesClass { * Get mapString * @return mapString **/ - public Map getMapString() { + public Map getMapString() { return mapString; } @@ -90,7 +106,6 @@ public class AdditionalPropertiesClass { * Get mapNumber * @return mapNumber **/ - @Valid public Map getMapNumber() { return mapNumber; } @@ -116,7 +131,7 @@ public class AdditionalPropertiesClass { * Get mapInteger * @return mapInteger **/ - public Map getMapInteger() { + public Map getMapInteger() { return mapInteger; } @@ -141,7 +156,7 @@ public class AdditionalPropertiesClass { * Get mapBoolean * @return mapBoolean **/ - public Map getMapBoolean() { + public Map getMapBoolean() { return mapBoolean; } @@ -166,7 +181,6 @@ public class AdditionalPropertiesClass { * Get mapArrayInteger * @return mapArrayInteger **/ - @Valid public Map> getMapArrayInteger() { return mapArrayInteger; } @@ -192,7 +206,6 @@ public class AdditionalPropertiesClass { * Get mapArrayAnytype * @return mapArrayAnytype **/ - @Valid public Map> getMapArrayAnytype() { return mapArrayAnytype; } @@ -218,7 +231,6 @@ public class AdditionalPropertiesClass { * Get mapMapString * @return mapMapString **/ - @Valid public Map> getMapMapString() { return mapMapString; } @@ -244,7 +256,6 @@ public class AdditionalPropertiesClass { * Get mapMapAnytype * @return mapMapAnytype **/ - @Valid public Map> getMapMapAnytype() { return mapMapAnytype; } @@ -262,7 +273,7 @@ public class AdditionalPropertiesClass { * Get anytype1 * @return anytype1 **/ - public Object getAnytype1() { + public Object getAnytype1() { return anytype1; } @@ -279,7 +290,7 @@ public class AdditionalPropertiesClass { * Get anytype2 * @return anytype2 **/ - public Object getAnytype2() { + public Object getAnytype2() { return anytype2; } @@ -296,7 +307,7 @@ public class AdditionalPropertiesClass { * Get anytype3 * @return anytype3 **/ - public Object getAnytype3() { + public Object getAnytype3() { return anytype3; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesInteger.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesInteger.java index 7f2a305f5d5..9d1d43a69d8 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesInteger.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesInteger.java @@ -14,6 +14,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class AdditionalPropertiesInteger extends HashMap { @JsonProperty("name") + private String name; public AdditionalPropertiesInteger name(String name) { @@ -25,7 +26,7 @@ public class AdditionalPropertiesInteger extends HashMap { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesNumber.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesNumber.java index a74714db2a3..d87ad137d02 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesNumber.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesNumber.java @@ -15,6 +15,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class AdditionalPropertiesNumber extends HashMap { @JsonProperty("name") + private String name; public AdditionalPropertiesNumber name(String name) { @@ -26,7 +27,7 @@ public class AdditionalPropertiesNumber extends HashMap { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesObject.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesObject.java index 8272dcec080..c7bf488d2ff 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesObject.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesObject.java @@ -14,6 +14,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class AdditionalPropertiesObject extends HashMap { @JsonProperty("name") + private String name; public AdditionalPropertiesObject name(String name) { @@ -25,7 +26,7 @@ public class AdditionalPropertiesObject extends HashMap { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesString.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesString.java index 2ce4c9da5b0..0c2c8c1ebc4 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesString.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesString.java @@ -14,6 +14,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class AdditionalPropertiesString extends HashMap { @JsonProperty("name") + private String name; public AdditionalPropertiesString name(String name) { @@ -25,7 +26,7 @@ public class AdditionalPropertiesString extends HashMap { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Animal.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Animal.java index ae6374df458..732c05a1468 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Animal.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Animal.java @@ -14,9 +14,12 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Animal { @JsonProperty("className") + @NotNull + private String className; @JsonProperty("color") + private String color = "red"; public Animal className(String className) { @@ -28,7 +31,6 @@ public class Animal { * Get className * @return className **/ - @NotNull public String getClassName() { return className; } @@ -46,7 +48,7 @@ public class Animal { * Get color * @return color **/ - public String getColor() { + public String getColor() { return color; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfArrayOfNumberOnly.java index 34bb0c90e55..ba9e0d9bf44 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfArrayOfNumberOnly.java @@ -15,6 +15,8 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ArrayOfArrayOfNumberOnly { @JsonProperty("ArrayArrayNumber") + @Valid + private List> arrayArrayNumber = null; public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { @@ -34,7 +36,6 @@ public class ArrayOfArrayOfNumberOnly { * Get arrayArrayNumber * @return arrayArrayNumber **/ - @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfNumberOnly.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfNumberOnly.java index 9b43b47fb44..bca0376c0e5 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfNumberOnly.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfNumberOnly.java @@ -15,6 +15,8 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ArrayOfNumberOnly { @JsonProperty("ArrayNumber") + @Valid + private List arrayNumber = null; public ArrayOfNumberOnly arrayNumber(List arrayNumber) { @@ -34,7 +36,6 @@ public class ArrayOfNumberOnly { * Get arrayNumber * @return arrayNumber **/ - @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayTest.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayTest.java index 0ba694f5f54..d9701181453 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayTest.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayTest.java @@ -15,12 +15,17 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ArrayTest { @JsonProperty("array_of_string") + private List arrayOfString = null; @JsonProperty("array_array_of_integer") + @Valid + private List> arrayArrayOfInteger = null; @JsonProperty("array_array_of_model") + @Valid + private List> arrayArrayOfModel = null; public ArrayTest arrayOfString(List arrayOfString) { @@ -40,7 +45,7 @@ public class ArrayTest { * Get arrayOfString * @return arrayOfString **/ - public List getArrayOfString() { + public List getArrayOfString() { return arrayOfString; } @@ -65,7 +70,6 @@ public class ArrayTest { * Get arrayArrayOfInteger * @return arrayArrayOfInteger **/ - @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -91,7 +95,6 @@ public class ArrayTest { * Get arrayArrayOfModel * @return arrayArrayOfModel **/ - @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCat.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCat.java index 79ad7c7eb4a..ac832bcfd82 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCat.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCat.java @@ -49,6 +49,7 @@ public class BigCat extends Cat { } @JsonProperty("kind") + private KindEnum kind; public BigCat kind(KindEnum kind) { @@ -60,7 +61,7 @@ public class BigCat extends Cat { * Get kind * @return kind **/ - public KindEnum getKind() { + public KindEnum getKind() { return kind; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCatAllOf.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCatAllOf.java index b5b3979aa40..c0e2cdeab1a 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCatAllOf.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCatAllOf.java @@ -47,6 +47,7 @@ public class BigCatAllOf { } @JsonProperty("kind") + private KindEnum kind; public BigCatAllOf kind(KindEnum kind) { @@ -58,7 +59,7 @@ public class BigCatAllOf { * Get kind * @return kind **/ - public KindEnum getKind() { + public KindEnum getKind() { return kind; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Capitalization.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Capitalization.java index 374b619f88f..adbe5dd10fa 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Capitalization.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Capitalization.java @@ -12,21 +12,27 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Capitalization { @JsonProperty("smallCamel") + private String smallCamel; @JsonProperty("CapitalCamel") + private String capitalCamel; @JsonProperty("small_Snake") + private String smallSnake; @JsonProperty("Capital_Snake") + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { @@ -38,7 +44,7 @@ public class Capitalization { * Get smallCamel * @return smallCamel **/ - public String getSmallCamel() { + public String getSmallCamel() { return smallCamel; } @@ -55,7 +61,7 @@ public class Capitalization { * Get capitalCamel * @return capitalCamel **/ - public String getCapitalCamel() { + public String getCapitalCamel() { return capitalCamel; } @@ -72,7 +78,7 @@ public class Capitalization { * Get smallSnake * @return smallSnake **/ - public String getSmallSnake() { + public String getSmallSnake() { return smallSnake; } @@ -89,7 +95,7 @@ public class Capitalization { * Get capitalSnake * @return capitalSnake **/ - public String getCapitalSnake() { + public String getCapitalSnake() { return capitalSnake; } @@ -106,7 +112,7 @@ public class Capitalization { * Get scAETHFlowPoints * @return scAETHFlowPoints **/ - public String getScAETHFlowPoints() { + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -123,7 +129,7 @@ public class Capitalization { * Name of the pet * @return ATT_NAME **/ - public String getATTNAME() { + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Cat.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Cat.java index c414034cc40..7f4b72e2c49 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Cat.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Cat.java @@ -14,6 +14,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Cat extends Animal { @JsonProperty("declawed") + private Boolean declawed; public Cat declawed(Boolean declawed) { @@ -25,7 +26,7 @@ public class Cat extends Animal { * Get declawed * @return declawed **/ - public Boolean getDeclawed() { + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/CatAllOf.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/CatAllOf.java index e6e3f5115cf..d9b481c439b 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/CatAllOf.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/CatAllOf.java @@ -12,6 +12,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class CatAllOf { @JsonProperty("declawed") + private Boolean declawed; public CatAllOf declawed(Boolean declawed) { @@ -23,7 +24,7 @@ public class CatAllOf { * Get declawed * @return declawed **/ - public Boolean getDeclawed() { + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Category.java index 63fc1cbb0f9..453ad7e2a95 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Category.java @@ -12,9 +12,12 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") + private Long id; @JsonProperty("name") + @NotNull + private String name = "default-name"; public Category id(Long id) { @@ -26,7 +29,7 @@ public class Category { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +46,6 @@ public class Category { * Get name * @return name **/ - @NotNull public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ClassModel.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ClassModel.java index ad5868b9bc6..a35a880dd0c 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ClassModel.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ClassModel.java @@ -12,6 +12,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ClassModel { @JsonProperty("_class") + private String propertyClass; public ClassModel propertyClass(String propertyClass) { @@ -23,7 +24,7 @@ public class ClassModel { * Get propertyClass * @return propertyClass **/ - public String getPropertyClass() { + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Client.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Client.java index 2130dfdc2c9..e5792709a19 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Client.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Client.java @@ -12,6 +12,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Client { @JsonProperty("client") + private String client; public Client client(String client) { @@ -23,7 +24,7 @@ public class Client { * Get client * @return client **/ - public String getClient() { + public String getClient() { return client; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Dog.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Dog.java index 8404afdf715..f9d261dc5f8 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Dog.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Dog.java @@ -14,6 +14,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Dog extends Animal { @JsonProperty("breed") + private String breed; public Dog breed(String breed) { @@ -25,7 +26,7 @@ public class Dog extends Animal { * Get breed * @return breed **/ - public String getBreed() { + public String getBreed() { return breed; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/DogAllOf.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/DogAllOf.java index 98116a594d9..ea23e72c16e 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/DogAllOf.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/DogAllOf.java @@ -12,6 +12,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class DogAllOf { @JsonProperty("breed") + private String breed; public DogAllOf breed(String breed) { @@ -23,7 +24,7 @@ public class DogAllOf { * Get breed * @return breed **/ - public String getBreed() { + public String getBreed() { return breed; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumArrays.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumArrays.java index 3b80000144b..022ba7cea91 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumArrays.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumArrays.java @@ -45,6 +45,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") + private JustSymbolEnum justSymbol; /** @@ -79,6 +80,7 @@ public class EnumArrays { } @JsonProperty("array_enum") + private List arrayEnum = null; public EnumArrays justSymbol(JustSymbolEnum justSymbol) { @@ -90,7 +92,7 @@ public class EnumArrays { * Get justSymbol * @return justSymbol **/ - public JustSymbolEnum getJustSymbol() { + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -115,7 +117,7 @@ public class EnumArrays { * Get arrayEnum * @return arrayEnum **/ - public List getArrayEnum() { + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumTest.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumTest.java index 7f69d1bd531..fd50cfba92f 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumTest.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumTest.java @@ -46,6 +46,7 @@ public class EnumTest { } @JsonProperty("enum_string") + private EnumStringEnum enumString; /** @@ -82,6 +83,8 @@ public class EnumTest { } @JsonProperty("enum_string_required") + @NotNull + private EnumStringRequiredEnum enumStringRequired; /** @@ -116,6 +119,7 @@ public class EnumTest { } @JsonProperty("enum_integer") + private EnumIntegerEnum enumInteger; /** @@ -150,9 +154,12 @@ public class EnumTest { } @JsonProperty("enum_number") + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") + @Valid + private OuterEnum outerEnum; public EnumTest enumString(EnumStringEnum enumString) { @@ -164,7 +171,7 @@ public class EnumTest { * Get enumString * @return enumString **/ - public EnumStringEnum getEnumString() { + public EnumStringEnum getEnumString() { return enumString; } @@ -181,7 +188,6 @@ public class EnumTest { * Get enumStringRequired * @return enumStringRequired **/ - @NotNull public EnumStringRequiredEnum getEnumStringRequired() { return enumStringRequired; } @@ -199,7 +205,7 @@ public class EnumTest { * Get enumInteger * @return enumInteger **/ - public EnumIntegerEnum getEnumInteger() { + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -216,7 +222,7 @@ public class EnumTest { * Get enumNumber * @return enumNumber **/ - public EnumNumberEnum getEnumNumber() { + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -233,7 +239,6 @@ public class EnumTest { * Get outerEnum * @return outerEnum **/ - @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FileSchemaTestClass.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FileSchemaTestClass.java index c8c7a6c8e02..03d1c1b0cce 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FileSchemaTestClass.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FileSchemaTestClass.java @@ -14,9 +14,13 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class FileSchemaTestClass { @JsonProperty("file") + @Valid + private java.io.File file; @JsonProperty("files") + @Valid + private List files = null; public FileSchemaTestClass file(java.io.File file) { @@ -28,7 +32,6 @@ public class FileSchemaTestClass { * Get file * @return file **/ - @Valid public java.io.File getFile() { return file; } @@ -54,7 +57,6 @@ public class FileSchemaTestClass { * Get files * @return files **/ - @Valid public List getFiles() { return files; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FormatTest.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FormatTest.java index 324eb807822..c202d9340e7 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FormatTest.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FormatTest.java @@ -17,45 +17,82 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class FormatTest { @JsonProperty("integer") + @Min(10) +@Max(100) + private Integer integer; @JsonProperty("int32") + @Min(20) +@Max(200) + private Integer int32; @JsonProperty("int64") + private Long int64; @JsonProperty("number") + @NotNull +@DecimalMin("32.1") +@DecimalMax("543.2") +@Valid + private BigDecimal number; @JsonProperty("float") + @DecimalMin("54.3") +@DecimalMax("987.6") + private Float _float; @JsonProperty("double") + @DecimalMin("67.8") +@DecimalMax("123.4") + private Double _double; @JsonProperty("string") + @Pattern(regexp="/[a-z]/i") + private String string; @JsonProperty("byte") + @NotNull +@Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") + private byte[] _byte; @JsonProperty("binary") + @Valid + private InputStream binary; @JsonProperty("date") + @NotNull +@Valid + private LocalDate date; @JsonProperty("dateTime") + @Valid + private OffsetDateTime dateTime; @JsonProperty("uuid") + @Valid + private UUID uuid; @JsonProperty("password") + @NotNull +@Size(min=10,max=64) + private String password; @JsonProperty("BigDecimal") + @Valid + private BigDecimal bigDecimal; public FormatTest integer(Integer integer) { @@ -69,8 +106,6 @@ public class FormatTest { * maximum: 100 * @return integer **/ - @Min(10) -@Max(100) public Integer getInteger() { return integer; } @@ -90,8 +125,6 @@ public class FormatTest { * maximum: 200 * @return int32 **/ - @Min(20) -@Max(200) public Integer getInt32() { return int32; } @@ -109,7 +142,7 @@ public class FormatTest { * Get int64 * @return int64 **/ - public Long getInt64() { + public Long getInt64() { return int64; } @@ -128,10 +161,6 @@ public class FormatTest { * maximum: 543.2 * @return number **/ - @NotNull -@DecimalMin("32.1") -@DecimalMax("543.2") -@Valid public BigDecimal getNumber() { return number; } @@ -151,8 +180,6 @@ public class FormatTest { * maximum: 987.6 * @return _float **/ - @DecimalMin("54.3") -@DecimalMax("987.6") public Float getFloat() { return _float; } @@ -172,8 +199,6 @@ public class FormatTest { * maximum: 123.4 * @return _double **/ - @DecimalMin("67.8") -@DecimalMax("123.4") public Double getDouble() { return _double; } @@ -191,7 +216,6 @@ public class FormatTest { * Get string * @return string **/ - @Pattern(regexp="/[a-z]/i") public String getString() { return string; } @@ -209,8 +233,6 @@ public class FormatTest { * Get _byte * @return _byte **/ - @NotNull -@Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") public byte[] getByte() { return _byte; } @@ -228,7 +250,6 @@ public class FormatTest { * Get binary * @return binary **/ - @Valid public InputStream getBinary() { return binary; } @@ -246,8 +267,6 @@ public class FormatTest { * Get date * @return date **/ - @NotNull -@Valid public LocalDate getDate() { return date; } @@ -265,7 +284,6 @@ public class FormatTest { * Get dateTime * @return dateTime **/ - @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -283,7 +301,6 @@ public class FormatTest { * Get uuid * @return uuid **/ - @Valid public UUID getUuid() { return uuid; } @@ -301,8 +318,6 @@ public class FormatTest { * Get password * @return password **/ - @NotNull -@Size(min=10,max=64) public String getPassword() { return password; } @@ -320,7 +335,6 @@ public class FormatTest { * Get bigDecimal * @return bigDecimal **/ - @Valid public BigDecimal getBigDecimal() { return bigDecimal; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/HasOnlyReadOnly.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/HasOnlyReadOnly.java index 2afc42d8a82..fa8b55adabe 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/HasOnlyReadOnly.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/HasOnlyReadOnly.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class HasOnlyReadOnly { @JsonProperty("bar") + private String bar; @JsonProperty("foo") + private String foo; public HasOnlyReadOnly bar(String bar) { @@ -26,7 +28,7 @@ public class HasOnlyReadOnly { * Get bar * @return bar **/ - public String getBar() { + public String getBar() { return bar; } @@ -43,7 +45,7 @@ public class HasOnlyReadOnly { * Get foo * @return foo **/ - public String getFoo() { + public String getFoo() { return foo; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MapTest.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MapTest.java index 32ca77aff2a..39fc7c4eeb7 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MapTest.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MapTest.java @@ -15,6 +15,8 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class MapTest { @JsonProperty("map_map_of_string") + @Valid + private Map> mapMapOfString = null; /** @@ -49,12 +51,15 @@ public class MapTest { } @JsonProperty("map_of_enum_string") + private Map mapOfEnumString = null; @JsonProperty("direct_map") + private Map directMap = null; @JsonProperty("indirect_map") + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { @@ -74,7 +79,6 @@ public class MapTest { * Get mapMapOfString * @return mapMapOfString **/ - @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -100,7 +104,7 @@ public class MapTest { * Get mapOfEnumString * @return mapOfEnumString **/ - public Map getMapOfEnumString() { + public Map getMapOfEnumString() { return mapOfEnumString; } @@ -125,7 +129,7 @@ public class MapTest { * Get directMap * @return directMap **/ - public Map getDirectMap() { + public Map getDirectMap() { return directMap; } @@ -150,7 +154,7 @@ public class MapTest { * Get indirectMap * @return indirectMap **/ - public Map getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MixedPropertiesAndAdditionalPropertiesClass.java index e6f31ddfe8d..7a6477b1916 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MixedPropertiesAndAdditionalPropertiesClass.java @@ -18,12 +18,18 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") + @Valid + private UUID uuid; @JsonProperty("dateTime") + @Valid + private OffsetDateTime dateTime; @JsonProperty("map") + @Valid + private Map map = null; public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { @@ -35,7 +41,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * Get uuid * @return uuid **/ - @Valid public UUID getUuid() { return uuid; } @@ -53,7 +58,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * Get dateTime * @return dateTime **/ - @Valid public OffsetDateTime getDateTime() { return dateTime; } @@ -79,7 +83,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * Get map * @return map **/ - @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Model200Response.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Model200Response.java index ab899b2a995..f0ca332d186 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Model200Response.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Model200Response.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Model200Response { @JsonProperty("name") + private Integer name; @JsonProperty("class") + private String propertyClass; public Model200Response name(Integer name) { @@ -26,7 +28,7 @@ public class Model200Response { * Get name * @return name **/ - public Integer getName() { + public Integer getName() { return name; } @@ -43,7 +45,7 @@ public class Model200Response { * Get propertyClass * @return propertyClass **/ - public String getPropertyClass() { + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelApiResponse.java index 4fb0e8a18ae..75f9e7c5d46 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelApiResponse.java @@ -12,12 +12,15 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") + private Integer code; @JsonProperty("type") + private String type; @JsonProperty("message") + private String message; public ModelApiResponse code(Integer code) { @@ -29,7 +32,7 @@ public class ModelApiResponse { * Get code * @return code **/ - public Integer getCode() { + public Integer getCode() { return code; } @@ -46,7 +49,7 @@ public class ModelApiResponse { * Get type * @return type **/ - public String getType() { + public String getType() { return type; } @@ -63,7 +66,7 @@ public class ModelApiResponse { * Get message * @return message **/ - public String getMessage() { + public String getMessage() { return message; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelReturn.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelReturn.java index dcefaa6f206..298399adb2a 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelReturn.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelReturn.java @@ -12,6 +12,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelReturn { @JsonProperty("return") + private Integer _return; public ModelReturn _return(Integer _return) { @@ -23,7 +24,7 @@ public class ModelReturn { * Get _return * @return _return **/ - public Integer getReturn() { + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Name.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Name.java index 2e5158056e9..232f49c5dce 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Name.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Name.java @@ -12,15 +12,20 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Name { @JsonProperty("name") + @NotNull + private Integer name; @JsonProperty("snake_case") + private Integer snakeCase; @JsonProperty("property") + private String property; @JsonProperty("123Number") + private Integer _123number; public Name name(Integer name) { @@ -32,7 +37,6 @@ public class Name { * Get name * @return name **/ - @NotNull public Integer getName() { return name; } @@ -50,7 +54,7 @@ public class Name { * Get snakeCase * @return snakeCase **/ - public Integer getSnakeCase() { + public Integer getSnakeCase() { return snakeCase; } @@ -67,7 +71,7 @@ public class Name { * Get property * @return property **/ - public String getProperty() { + public String getProperty() { return property; } @@ -84,7 +88,7 @@ public class Name { * Get _123number * @return _123number **/ - public Integer get123number() { + public Integer get123number() { return _123number; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/NumberOnly.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/NumberOnly.java index 05bea5047a3..bbcccc2ebe0 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/NumberOnly.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/NumberOnly.java @@ -13,6 +13,8 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class NumberOnly { @JsonProperty("JustNumber") + @Valid + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { @@ -24,7 +26,6 @@ public class NumberOnly { * Get justNumber * @return justNumber **/ - @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Order.java index 499a6d5d89c..ad0b6c1e861 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Order.java @@ -13,15 +13,20 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") + private Long id; @JsonProperty("petId") + private Long petId; @JsonProperty("quantity") + private Integer quantity; @JsonProperty("shipDate") + @Valid + private OffsetDateTime shipDate; /** @@ -58,9 +63,11 @@ public class Order { } @JsonProperty("status") + private StatusEnum status; @JsonProperty("complete") + private Boolean complete = false; public Order id(Long id) { @@ -72,7 +79,7 @@ public class Order { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -89,7 +96,7 @@ public class Order { * Get petId * @return petId **/ - public Long getPetId() { + public Long getPetId() { return petId; } @@ -106,7 +113,7 @@ public class Order { * Get quantity * @return quantity **/ - public Integer getQuantity() { + public Integer getQuantity() { return quantity; } @@ -123,7 +130,6 @@ public class Order { * Get shipDate * @return shipDate **/ - @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -141,7 +147,7 @@ public class Order { * Order Status * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } @@ -158,7 +164,7 @@ public class Order { * Get complete * @return complete **/ - public Boolean getComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterComposite.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterComposite.java index bbd9a3380ba..3f19923097a 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterComposite.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterComposite.java @@ -13,12 +13,16 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class OuterComposite { @JsonProperty("my_number") + @Valid + private BigDecimal myNumber; @JsonProperty("my_string") + private String myString; @JsonProperty("my_boolean") + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { @@ -30,7 +34,6 @@ public class OuterComposite { * Get myNumber * @return myNumber **/ - @Valid public BigDecimal getMyNumber() { return myNumber; } @@ -48,7 +51,7 @@ public class OuterComposite { * Get myString * @return myString **/ - public String getMyString() { + public String getMyString() { return myString; } @@ -65,7 +68,7 @@ public class OuterComposite { * Get myBoolean * @return myBoolean **/ - public Boolean getMyBoolean() { + public Boolean getMyBoolean() { return myBoolean; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Pet.java index 0d0d6dee1c0..819d8d21474 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Pet.java @@ -18,18 +18,27 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") + private Long id; @JsonProperty("category") + @Valid + private Category category; @JsonProperty("name") + @NotNull + private String name; @JsonProperty("photoUrls") + @NotNull + private Set photoUrls = new LinkedHashSet<>(); @JsonProperty("tags") + @Valid + private List tags = null; /** @@ -66,6 +75,7 @@ public class Pet { } @JsonProperty("status") + private StatusEnum status; public Pet id(Long id) { @@ -77,7 +87,7 @@ public class Pet { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -94,7 +104,6 @@ public class Pet { * Get category * @return category **/ - @Valid public Category getCategory() { return category; } @@ -112,7 +121,6 @@ public class Pet { * Get name * @return name **/ - @NotNull public String getName() { return name; } @@ -135,7 +143,6 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - @NotNull public Set getPhotoUrls() { return photoUrls; } @@ -161,7 +168,6 @@ public class Pet { * Get tags * @return tags **/ - @Valid public List getTags() { return tags; } @@ -179,7 +185,7 @@ public class Pet { * pet status in the store * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ReadOnlyFirst.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ReadOnlyFirst.java index ca26ecae233..55d2816002b 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ReadOnlyFirst.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ReadOnlyFirst.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ReadOnlyFirst { @JsonProperty("bar") + private String bar; @JsonProperty("baz") + private String baz; public ReadOnlyFirst bar(String bar) { @@ -26,7 +28,7 @@ public class ReadOnlyFirst { * Get bar * @return bar **/ - public String getBar() { + public String getBar() { return bar; } @@ -43,7 +45,7 @@ public class ReadOnlyFirst { * Get baz * @return baz **/ - public String getBaz() { + public String getBaz() { return baz; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/SpecialModelName.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/SpecialModelName.java index adcf5767490..dfbc01afecd 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/SpecialModelName.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/SpecialModelName.java @@ -12,6 +12,7 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class SpecialModelName { @JsonProperty("$special[property.name]") + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { @@ -23,7 +24,7 @@ public class SpecialModelName { * Get $specialPropertyName * @return $specialPropertyName **/ - public Long get$SpecialPropertyName() { + public Long get$SpecialPropertyName() { return $specialPropertyName; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Tag.java index 212267844c1..39bceb93f4a 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Tag.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Tag id(Long id) { @@ -26,7 +28,7 @@ public class Tag { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Tag { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/TypeHolderDefault.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/TypeHolderDefault.java index 74af3739b27..a8e52c7bfe5 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/TypeHolderDefault.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/TypeHolderDefault.java @@ -15,18 +15,29 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class TypeHolderDefault { @JsonProperty("string_item") + @NotNull + private String stringItem = "what"; @JsonProperty("number_item") + @NotNull +@Valid + private BigDecimal numberItem; @JsonProperty("integer_item") + @NotNull + private Integer integerItem; @JsonProperty("bool_item") + @NotNull + private Boolean boolItem = true; @JsonProperty("array_item") + @NotNull + private List arrayItem = new ArrayList<>(); public TypeHolderDefault stringItem(String stringItem) { @@ -38,7 +49,6 @@ public class TypeHolderDefault { * Get stringItem * @return stringItem **/ - @NotNull public String getStringItem() { return stringItem; } @@ -56,8 +66,6 @@ public class TypeHolderDefault { * Get numberItem * @return numberItem **/ - @NotNull -@Valid public BigDecimal getNumberItem() { return numberItem; } @@ -75,7 +83,6 @@ public class TypeHolderDefault { * Get integerItem * @return integerItem **/ - @NotNull public Integer getIntegerItem() { return integerItem; } @@ -93,7 +100,6 @@ public class TypeHolderDefault { * Get boolItem * @return boolItem **/ - @NotNull public Boolean getBoolItem() { return boolItem; } @@ -116,7 +122,6 @@ public class TypeHolderDefault { * Get arrayItem * @return arrayItem **/ - @NotNull public List getArrayItem() { return arrayItem; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/TypeHolderExample.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/TypeHolderExample.java index 0f18d25f21e..7295c42a7b3 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/TypeHolderExample.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/TypeHolderExample.java @@ -15,21 +15,34 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class TypeHolderExample { @JsonProperty("string_item") + @NotNull + private String stringItem; @JsonProperty("number_item") + @NotNull +@Valid + private BigDecimal numberItem; @JsonProperty("float_item") + @NotNull + private Float floatItem; @JsonProperty("integer_item") + @NotNull + private Integer integerItem; @JsonProperty("bool_item") + @NotNull + private Boolean boolItem; @JsonProperty("array_item") + @NotNull + private List arrayItem = new ArrayList<>(); public TypeHolderExample stringItem(String stringItem) { @@ -41,7 +54,6 @@ public class TypeHolderExample { * Get stringItem * @return stringItem **/ - @NotNull public String getStringItem() { return stringItem; } @@ -59,8 +71,6 @@ public class TypeHolderExample { * Get numberItem * @return numberItem **/ - @NotNull -@Valid public BigDecimal getNumberItem() { return numberItem; } @@ -78,7 +88,6 @@ public class TypeHolderExample { * Get floatItem * @return floatItem **/ - @NotNull public Float getFloatItem() { return floatItem; } @@ -96,7 +105,6 @@ public class TypeHolderExample { * Get integerItem * @return integerItem **/ - @NotNull public Integer getIntegerItem() { return integerItem; } @@ -114,7 +122,6 @@ public class TypeHolderExample { * Get boolItem * @return boolItem **/ - @NotNull public Boolean getBoolItem() { return boolItem; } @@ -137,7 +144,6 @@ public class TypeHolderExample { * Get arrayItem * @return arrayItem **/ - @NotNull public List getArrayItem() { return arrayItem; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/User.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/User.java index adf6aa8bae7..72ef978f3dc 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/User.java @@ -12,27 +12,35 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") + private Long id; @JsonProperty("username") + private String username; @JsonProperty("firstName") + private String firstName; @JsonProperty("lastName") + private String lastName; @JsonProperty("email") + private String email; @JsonProperty("password") + private String password; @JsonProperty("phone") + private String phone; @JsonProperty("userStatus") + private Integer userStatus; public User id(Long id) { @@ -44,7 +52,7 @@ public class User { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -61,7 +69,7 @@ public class User { * Get username * @return username **/ - public String getUsername() { + public String getUsername() { return username; } @@ -78,7 +86,7 @@ public class User { * Get firstName * @return firstName **/ - public String getFirstName() { + public String getFirstName() { return firstName; } @@ -95,7 +103,7 @@ public class User { * Get lastName * @return lastName **/ - public String getLastName() { + public String getLastName() { return lastName; } @@ -112,7 +120,7 @@ public class User { * Get email * @return email **/ - public String getEmail() { + public String getEmail() { return email; } @@ -129,7 +137,7 @@ public class User { * Get password * @return password **/ - public String getPassword() { + public String getPassword() { return password; } @@ -146,7 +154,7 @@ public class User { * Get phone * @return phone **/ - public String getPhone() { + public String getPhone() { return phone; } @@ -163,7 +171,7 @@ public class User { * User Status * @return userStatus **/ - public Integer getUserStatus() { + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/XmlItem.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/XmlItem.java index 31c65921b23..114918e3cf9 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/XmlItem.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/XmlItem.java @@ -15,90 +15,124 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class XmlItem { @JsonProperty("attribute_string") + private String attributeString; @JsonProperty("attribute_number") + @Valid + private BigDecimal attributeNumber; @JsonProperty("attribute_integer") + private Integer attributeInteger; @JsonProperty("attribute_boolean") + private Boolean attributeBoolean; @JsonProperty("wrapped_array") + private List wrappedArray = null; @JsonProperty("name_string") + private String nameString; @JsonProperty("name_number") + @Valid + private BigDecimal nameNumber; @JsonProperty("name_integer") + private Integer nameInteger; @JsonProperty("name_boolean") + private Boolean nameBoolean; @JsonProperty("name_array") + private List nameArray = null; @JsonProperty("name_wrapped_array") + private List nameWrappedArray = null; @JsonProperty("prefix_string") + private String prefixString; @JsonProperty("prefix_number") + @Valid + private BigDecimal prefixNumber; @JsonProperty("prefix_integer") + private Integer prefixInteger; @JsonProperty("prefix_boolean") + private Boolean prefixBoolean; @JsonProperty("prefix_array") + private List prefixArray = null; @JsonProperty("prefix_wrapped_array") + private List prefixWrappedArray = null; @JsonProperty("namespace_string") + private String namespaceString; @JsonProperty("namespace_number") + @Valid + private BigDecimal namespaceNumber; @JsonProperty("namespace_integer") + private Integer namespaceInteger; @JsonProperty("namespace_boolean") + private Boolean namespaceBoolean; @JsonProperty("namespace_array") + private List namespaceArray = null; @JsonProperty("namespace_wrapped_array") + private List namespaceWrappedArray = null; @JsonProperty("prefix_ns_string") + private String prefixNsString; @JsonProperty("prefix_ns_number") + @Valid + private BigDecimal prefixNsNumber; @JsonProperty("prefix_ns_integer") + private Integer prefixNsInteger; @JsonProperty("prefix_ns_boolean") + private Boolean prefixNsBoolean; @JsonProperty("prefix_ns_array") + private List prefixNsArray = null; @JsonProperty("prefix_ns_wrapped_array") + private List prefixNsWrappedArray = null; public XmlItem attributeString(String attributeString) { @@ -110,7 +144,7 @@ public class XmlItem { * Get attributeString * @return attributeString **/ - public String getAttributeString() { + public String getAttributeString() { return attributeString; } @@ -127,7 +161,6 @@ public class XmlItem { * Get attributeNumber * @return attributeNumber **/ - @Valid public BigDecimal getAttributeNumber() { return attributeNumber; } @@ -145,7 +178,7 @@ public class XmlItem { * Get attributeInteger * @return attributeInteger **/ - public Integer getAttributeInteger() { + public Integer getAttributeInteger() { return attributeInteger; } @@ -162,7 +195,7 @@ public class XmlItem { * Get attributeBoolean * @return attributeBoolean **/ - public Boolean getAttributeBoolean() { + public Boolean getAttributeBoolean() { return attributeBoolean; } @@ -187,7 +220,7 @@ public class XmlItem { * Get wrappedArray * @return wrappedArray **/ - public List getWrappedArray() { + public List getWrappedArray() { return wrappedArray; } @@ -204,7 +237,7 @@ public class XmlItem { * Get nameString * @return nameString **/ - public String getNameString() { + public String getNameString() { return nameString; } @@ -221,7 +254,6 @@ public class XmlItem { * Get nameNumber * @return nameNumber **/ - @Valid public BigDecimal getNameNumber() { return nameNumber; } @@ -239,7 +271,7 @@ public class XmlItem { * Get nameInteger * @return nameInteger **/ - public Integer getNameInteger() { + public Integer getNameInteger() { return nameInteger; } @@ -256,7 +288,7 @@ public class XmlItem { * Get nameBoolean * @return nameBoolean **/ - public Boolean getNameBoolean() { + public Boolean getNameBoolean() { return nameBoolean; } @@ -281,7 +313,7 @@ public class XmlItem { * Get nameArray * @return nameArray **/ - public List getNameArray() { + public List getNameArray() { return nameArray; } @@ -306,7 +338,7 @@ public class XmlItem { * Get nameWrappedArray * @return nameWrappedArray **/ - public List getNameWrappedArray() { + public List getNameWrappedArray() { return nameWrappedArray; } @@ -323,7 +355,7 @@ public class XmlItem { * Get prefixString * @return prefixString **/ - public String getPrefixString() { + public String getPrefixString() { return prefixString; } @@ -340,7 +372,6 @@ public class XmlItem { * Get prefixNumber * @return prefixNumber **/ - @Valid public BigDecimal getPrefixNumber() { return prefixNumber; } @@ -358,7 +389,7 @@ public class XmlItem { * Get prefixInteger * @return prefixInteger **/ - public Integer getPrefixInteger() { + public Integer getPrefixInteger() { return prefixInteger; } @@ -375,7 +406,7 @@ public class XmlItem { * Get prefixBoolean * @return prefixBoolean **/ - public Boolean getPrefixBoolean() { + public Boolean getPrefixBoolean() { return prefixBoolean; } @@ -400,7 +431,7 @@ public class XmlItem { * Get prefixArray * @return prefixArray **/ - public List getPrefixArray() { + public List getPrefixArray() { return prefixArray; } @@ -425,7 +456,7 @@ public class XmlItem { * Get prefixWrappedArray * @return prefixWrappedArray **/ - public List getPrefixWrappedArray() { + public List getPrefixWrappedArray() { return prefixWrappedArray; } @@ -442,7 +473,7 @@ public class XmlItem { * Get namespaceString * @return namespaceString **/ - public String getNamespaceString() { + public String getNamespaceString() { return namespaceString; } @@ -459,7 +490,6 @@ public class XmlItem { * Get namespaceNumber * @return namespaceNumber **/ - @Valid public BigDecimal getNamespaceNumber() { return namespaceNumber; } @@ -477,7 +507,7 @@ public class XmlItem { * Get namespaceInteger * @return namespaceInteger **/ - public Integer getNamespaceInteger() { + public Integer getNamespaceInteger() { return namespaceInteger; } @@ -494,7 +524,7 @@ public class XmlItem { * Get namespaceBoolean * @return namespaceBoolean **/ - public Boolean getNamespaceBoolean() { + public Boolean getNamespaceBoolean() { return namespaceBoolean; } @@ -519,7 +549,7 @@ public class XmlItem { * Get namespaceArray * @return namespaceArray **/ - public List getNamespaceArray() { + public List getNamespaceArray() { return namespaceArray; } @@ -544,7 +574,7 @@ public class XmlItem { * Get namespaceWrappedArray * @return namespaceWrappedArray **/ - public List getNamespaceWrappedArray() { + public List getNamespaceWrappedArray() { return namespaceWrappedArray; } @@ -561,7 +591,7 @@ public class XmlItem { * Get prefixNsString * @return prefixNsString **/ - public String getPrefixNsString() { + public String getPrefixNsString() { return prefixNsString; } @@ -578,7 +608,6 @@ public class XmlItem { * Get prefixNsNumber * @return prefixNsNumber **/ - @Valid public BigDecimal getPrefixNsNumber() { return prefixNsNumber; } @@ -596,7 +625,7 @@ public class XmlItem { * Get prefixNsInteger * @return prefixNsInteger **/ - public Integer getPrefixNsInteger() { + public Integer getPrefixNsInteger() { return prefixNsInteger; } @@ -613,7 +642,7 @@ public class XmlItem { * Get prefixNsBoolean * @return prefixNsBoolean **/ - public Boolean getPrefixNsBoolean() { + public Boolean getPrefixNsBoolean() { return prefixNsBoolean; } @@ -638,7 +667,7 @@ public class XmlItem { * Get prefixNsArray * @return prefixNsArray **/ - public List getPrefixNsArray() { + public List getPrefixNsArray() { return prefixNsArray; } @@ -663,7 +692,7 @@ public class XmlItem { * Get prefixNsWrappedArray * @return prefixNsWrappedArray **/ - public List getPrefixNsWrappedArray() { + public List getPrefixNsWrappedArray() { return prefixNsWrappedArray; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/build.sbt b/samples/server/petstore/java-play-framework-fake-endpoints/build.sbt index 83a17e91013..b972893fc3f 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/build.sbt +++ b/samples/server/petstore/java-play-framework-fake-endpoints/build.sbt @@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.12.6" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5" -libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" +libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final" libraryDependencies += guice diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Category.java index bc4b68aa5f7..cd9f11b6c1d 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Category.java @@ -25,7 +25,7 @@ public class Category { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -42,7 +42,7 @@ public class Category { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/ModelApiResponse.java index 2e8ae992ad4..8a08c1c5af3 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/ModelApiResponse.java @@ -28,7 +28,7 @@ public class ModelApiResponse { * Get code * @return code **/ - public Integer getCode() { + public Integer getCode() { return code; } @@ -45,7 +45,7 @@ public class ModelApiResponse { * Get type * @return type **/ - public String getType() { + public String getType() { return type; } @@ -62,7 +62,7 @@ public class ModelApiResponse { * Get message * @return message **/ - public String getMessage() { + public String getMessage() { return message; } diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Order.java index bb456ad63bb..d1783dc0b66 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Order.java @@ -71,7 +71,7 @@ public class Order { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -88,7 +88,7 @@ public class Order { * Get petId * @return petId **/ - public Long getPetId() { + public Long getPetId() { return petId; } @@ -105,7 +105,7 @@ public class Order { * Get quantity * @return quantity **/ - public Integer getQuantity() { + public Integer getQuantity() { return quantity; } @@ -122,7 +122,7 @@ public class Order { * Get shipDate * @return shipDate **/ - public OffsetDateTime getShipDate() { + public OffsetDateTime getShipDate() { return shipDate; } @@ -139,7 +139,7 @@ public class Order { * Order Status * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } @@ -156,7 +156,7 @@ public class Order { * Get complete * @return complete **/ - public Boolean getComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Pet.java index 1350c191b34..d9c93499fb7 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Pet.java @@ -74,7 +74,7 @@ public class Pet { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -91,7 +91,7 @@ public class Pet { * Get category * @return category **/ - public Category getCategory() { + public Category getCategory() { return category; } @@ -108,7 +108,7 @@ public class Pet { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } @@ -130,7 +130,7 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - public List getPhotoUrls() { + public List getPhotoUrls() { return photoUrls; } @@ -155,7 +155,7 @@ public class Pet { * Get tags * @return tags **/ - public List getTags() { + public List getTags() { return tags; } @@ -172,7 +172,7 @@ public class Pet { * pet status in the store * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Tag.java index 519bb38813a..e6981d8065b 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Tag.java @@ -25,7 +25,7 @@ public class Tag { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -42,7 +42,7 @@ public class Tag { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/User.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/User.java index 85af038c7ec..0d20e1f0852 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/User.java @@ -43,7 +43,7 @@ public class User { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -60,7 +60,7 @@ public class User { * Get username * @return username **/ - public String getUsername() { + public String getUsername() { return username; } @@ -77,7 +77,7 @@ public class User { * Get firstName * @return firstName **/ - public String getFirstName() { + public String getFirstName() { return firstName; } @@ -94,7 +94,7 @@ public class User { * Get lastName * @return lastName **/ - public String getLastName() { + public String getLastName() { return lastName; } @@ -111,7 +111,7 @@ public class User { * Get email * @return email **/ - public String getEmail() { + public String getEmail() { return email; } @@ -128,7 +128,7 @@ public class User { * Get password * @return password **/ - public String getPassword() { + public String getPassword() { return password; } @@ -145,7 +145,7 @@ public class User { * Get phone * @return phone **/ - public String getPhone() { + public String getPhone() { return phone; } @@ -162,7 +162,7 @@ public class User { * User Status * @return userStatus **/ - public Integer getUserStatus() { + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Category.java index c6f15ca13c3..afed4d545a9 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Category.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Category id(Long id) { @@ -26,7 +28,7 @@ public class Category { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Category { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/ModelApiResponse.java index b99eabed6fd..820779a1cd9 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/ModelApiResponse.java @@ -12,12 +12,15 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") + private Integer code; @JsonProperty("type") + private String type; @JsonProperty("message") + private String message; public ModelApiResponse code(Integer code) { @@ -29,7 +32,7 @@ public class ModelApiResponse { * Get code * @return code **/ - public Integer getCode() { + public Integer getCode() { return code; } @@ -46,7 +49,7 @@ public class ModelApiResponse { * Get type * @return type **/ - public String getType() { + public String getType() { return type; } @@ -63,7 +66,7 @@ public class ModelApiResponse { * Get message * @return message **/ - public String getMessage() { + public String getMessage() { return message; } diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Order.java index 2d378562807..d54cba148ad 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Order.java @@ -13,15 +13,20 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") + private Long id; @JsonProperty("petId") + private Long petId; @JsonProperty("quantity") + private Integer quantity; @JsonProperty("shipDate") + @Valid + private OffsetDateTime shipDate; /** @@ -58,9 +63,11 @@ public class Order { } @JsonProperty("status") + private StatusEnum status; @JsonProperty("complete") + private Boolean complete = false; public Order id(Long id) { @@ -72,7 +79,7 @@ public class Order { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -89,7 +96,7 @@ public class Order { * Get petId * @return petId **/ - public Long getPetId() { + public Long getPetId() { return petId; } @@ -106,7 +113,7 @@ public class Order { * Get quantity * @return quantity **/ - public Integer getQuantity() { + public Integer getQuantity() { return quantity; } @@ -123,7 +130,6 @@ public class Order { * Get shipDate * @return shipDate **/ - @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -141,7 +147,7 @@ public class Order { * Order Status * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } @@ -158,7 +164,7 @@ public class Order { * Get complete * @return complete **/ - public Boolean getComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Pet.java index f6c95ac4e9e..4699f7235ed 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Pet.java @@ -16,18 +16,27 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") + private Long id; @JsonProperty("category") + @Valid + private Category category; @JsonProperty("name") + @NotNull + private String name; @JsonProperty("photoUrls") + @NotNull + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") + @Valid + private List tags = null; /** @@ -64,6 +73,7 @@ public class Pet { } @JsonProperty("status") + private StatusEnum status; public Pet id(Long id) { @@ -75,7 +85,7 @@ public class Pet { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -92,7 +102,6 @@ public class Pet { * Get category * @return category **/ - @Valid public Category getCategory() { return category; } @@ -110,7 +119,6 @@ public class Pet { * Get name * @return name **/ - @NotNull public String getName() { return name; } @@ -133,7 +141,6 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - @NotNull public List getPhotoUrls() { return photoUrls; } @@ -159,7 +166,6 @@ public class Pet { * Get tags * @return tags **/ - @Valid public List getTags() { return tags; } @@ -177,7 +183,7 @@ public class Pet { * pet status in the store * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Tag.java index 47799f61395..adac882cd05 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Tag.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Tag id(Long id) { @@ -26,7 +28,7 @@ public class Tag { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Tag { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/User.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/User.java index dc119d03edf..4e5d397b990 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/User.java @@ -12,27 +12,35 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") + private Long id; @JsonProperty("username") + private String username; @JsonProperty("firstName") + private String firstName; @JsonProperty("lastName") + private String lastName; @JsonProperty("email") + private String email; @JsonProperty("password") + private String password; @JsonProperty("phone") + private String phone; @JsonProperty("userStatus") + private Integer userStatus; public User id(Long id) { @@ -44,7 +52,7 @@ public class User { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -61,7 +69,7 @@ public class User { * Get username * @return username **/ - public String getUsername() { + public String getUsername() { return username; } @@ -78,7 +86,7 @@ public class User { * Get firstName * @return firstName **/ - public String getFirstName() { + public String getFirstName() { return firstName; } @@ -95,7 +103,7 @@ public class User { * Get lastName * @return lastName **/ - public String getLastName() { + public String getLastName() { return lastName; } @@ -112,7 +120,7 @@ public class User { * Get email * @return email **/ - public String getEmail() { + public String getEmail() { return email; } @@ -129,7 +137,7 @@ public class User { * Get password * @return password **/ - public String getPassword() { + public String getPassword() { return password; } @@ -146,7 +154,7 @@ public class User { * Get phone * @return phone **/ - public String getPhone() { + public String getPhone() { return phone; } @@ -163,7 +171,7 @@ public class User { * User Status * @return userStatus **/ - public Integer getUserStatus() { + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/build.sbt b/samples/server/petstore/java-play-framework-no-exception-handling/build.sbt index 83a17e91013..b972893fc3f 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/build.sbt +++ b/samples/server/petstore/java-play-framework-no-exception-handling/build.sbt @@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.12.6" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5" -libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" +libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final" libraryDependencies += guice diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Category.java index c6f15ca13c3..afed4d545a9 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Category.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Category id(Long id) { @@ -26,7 +28,7 @@ public class Category { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Category { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/ModelApiResponse.java index b99eabed6fd..820779a1cd9 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/ModelApiResponse.java @@ -12,12 +12,15 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") + private Integer code; @JsonProperty("type") + private String type; @JsonProperty("message") + private String message; public ModelApiResponse code(Integer code) { @@ -29,7 +32,7 @@ public class ModelApiResponse { * Get code * @return code **/ - public Integer getCode() { + public Integer getCode() { return code; } @@ -46,7 +49,7 @@ public class ModelApiResponse { * Get type * @return type **/ - public String getType() { + public String getType() { return type; } @@ -63,7 +66,7 @@ public class ModelApiResponse { * Get message * @return message **/ - public String getMessage() { + public String getMessage() { return message; } diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Order.java index 2d378562807..d54cba148ad 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Order.java @@ -13,15 +13,20 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") + private Long id; @JsonProperty("petId") + private Long petId; @JsonProperty("quantity") + private Integer quantity; @JsonProperty("shipDate") + @Valid + private OffsetDateTime shipDate; /** @@ -58,9 +63,11 @@ public class Order { } @JsonProperty("status") + private StatusEnum status; @JsonProperty("complete") + private Boolean complete = false; public Order id(Long id) { @@ -72,7 +79,7 @@ public class Order { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -89,7 +96,7 @@ public class Order { * Get petId * @return petId **/ - public Long getPetId() { + public Long getPetId() { return petId; } @@ -106,7 +113,7 @@ public class Order { * Get quantity * @return quantity **/ - public Integer getQuantity() { + public Integer getQuantity() { return quantity; } @@ -123,7 +130,6 @@ public class Order { * Get shipDate * @return shipDate **/ - @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -141,7 +147,7 @@ public class Order { * Order Status * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } @@ -158,7 +164,7 @@ public class Order { * Get complete * @return complete **/ - public Boolean getComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Pet.java index f6c95ac4e9e..4699f7235ed 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Pet.java @@ -16,18 +16,27 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") + private Long id; @JsonProperty("category") + @Valid + private Category category; @JsonProperty("name") + @NotNull + private String name; @JsonProperty("photoUrls") + @NotNull + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") + @Valid + private List tags = null; /** @@ -64,6 +73,7 @@ public class Pet { } @JsonProperty("status") + private StatusEnum status; public Pet id(Long id) { @@ -75,7 +85,7 @@ public class Pet { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -92,7 +102,6 @@ public class Pet { * Get category * @return category **/ - @Valid public Category getCategory() { return category; } @@ -110,7 +119,6 @@ public class Pet { * Get name * @return name **/ - @NotNull public String getName() { return name; } @@ -133,7 +141,6 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - @NotNull public List getPhotoUrls() { return photoUrls; } @@ -159,7 +166,6 @@ public class Pet { * Get tags * @return tags **/ - @Valid public List getTags() { return tags; } @@ -177,7 +183,7 @@ public class Pet { * pet status in the store * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Tag.java index 47799f61395..adac882cd05 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Tag.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Tag id(Long id) { @@ -26,7 +28,7 @@ public class Tag { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Tag { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/User.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/User.java index dc119d03edf..4e5d397b990 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/User.java @@ -12,27 +12,35 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") + private Long id; @JsonProperty("username") + private String username; @JsonProperty("firstName") + private String firstName; @JsonProperty("lastName") + private String lastName; @JsonProperty("email") + private String email; @JsonProperty("password") + private String password; @JsonProperty("phone") + private String phone; @JsonProperty("userStatus") + private Integer userStatus; public User id(Long id) { @@ -44,7 +52,7 @@ public class User { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -61,7 +69,7 @@ public class User { * Get username * @return username **/ - public String getUsername() { + public String getUsername() { return username; } @@ -78,7 +86,7 @@ public class User { * Get firstName * @return firstName **/ - public String getFirstName() { + public String getFirstName() { return firstName; } @@ -95,7 +103,7 @@ public class User { * Get lastName * @return lastName **/ - public String getLastName() { + public String getLastName() { return lastName; } @@ -112,7 +120,7 @@ public class User { * Get email * @return email **/ - public String getEmail() { + public String getEmail() { return email; } @@ -129,7 +137,7 @@ public class User { * Get password * @return password **/ - public String getPassword() { + public String getPassword() { return password; } @@ -146,7 +154,7 @@ public class User { * Get phone * @return phone **/ - public String getPhone() { + public String getPhone() { return phone; } @@ -163,7 +171,7 @@ public class User { * User Status * @return userStatus **/ - public Integer getUserStatus() { + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/java-play-framework-no-interface/build.sbt b/samples/server/petstore/java-play-framework-no-interface/build.sbt index 83a17e91013..b972893fc3f 100644 --- a/samples/server/petstore/java-play-framework-no-interface/build.sbt +++ b/samples/server/petstore/java-play-framework-no-interface/build.sbt @@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.12.6" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5" -libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" +libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final" libraryDependencies += guice diff --git a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Category.java index c6f15ca13c3..afed4d545a9 100644 --- a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Category.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Category id(Long id) { @@ -26,7 +28,7 @@ public class Category { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Category { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/ModelApiResponse.java index b99eabed6fd..820779a1cd9 100644 --- a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/ModelApiResponse.java @@ -12,12 +12,15 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") + private Integer code; @JsonProperty("type") + private String type; @JsonProperty("message") + private String message; public ModelApiResponse code(Integer code) { @@ -29,7 +32,7 @@ public class ModelApiResponse { * Get code * @return code **/ - public Integer getCode() { + public Integer getCode() { return code; } @@ -46,7 +49,7 @@ public class ModelApiResponse { * Get type * @return type **/ - public String getType() { + public String getType() { return type; } @@ -63,7 +66,7 @@ public class ModelApiResponse { * Get message * @return message **/ - public String getMessage() { + public String getMessage() { return message; } diff --git a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Order.java index 2d378562807..d54cba148ad 100644 --- a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Order.java @@ -13,15 +13,20 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") + private Long id; @JsonProperty("petId") + private Long petId; @JsonProperty("quantity") + private Integer quantity; @JsonProperty("shipDate") + @Valid + private OffsetDateTime shipDate; /** @@ -58,9 +63,11 @@ public class Order { } @JsonProperty("status") + private StatusEnum status; @JsonProperty("complete") + private Boolean complete = false; public Order id(Long id) { @@ -72,7 +79,7 @@ public class Order { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -89,7 +96,7 @@ public class Order { * Get petId * @return petId **/ - public Long getPetId() { + public Long getPetId() { return petId; } @@ -106,7 +113,7 @@ public class Order { * Get quantity * @return quantity **/ - public Integer getQuantity() { + public Integer getQuantity() { return quantity; } @@ -123,7 +130,6 @@ public class Order { * Get shipDate * @return shipDate **/ - @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -141,7 +147,7 @@ public class Order { * Order Status * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } @@ -158,7 +164,7 @@ public class Order { * Get complete * @return complete **/ - public Boolean getComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Pet.java index f6c95ac4e9e..4699f7235ed 100644 --- a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Pet.java @@ -16,18 +16,27 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") + private Long id; @JsonProperty("category") + @Valid + private Category category; @JsonProperty("name") + @NotNull + private String name; @JsonProperty("photoUrls") + @NotNull + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") + @Valid + private List tags = null; /** @@ -64,6 +73,7 @@ public class Pet { } @JsonProperty("status") + private StatusEnum status; public Pet id(Long id) { @@ -75,7 +85,7 @@ public class Pet { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -92,7 +102,6 @@ public class Pet { * Get category * @return category **/ - @Valid public Category getCategory() { return category; } @@ -110,7 +119,6 @@ public class Pet { * Get name * @return name **/ - @NotNull public String getName() { return name; } @@ -133,7 +141,6 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - @NotNull public List getPhotoUrls() { return photoUrls; } @@ -159,7 +166,6 @@ public class Pet { * Get tags * @return tags **/ - @Valid public List getTags() { return tags; } @@ -177,7 +183,7 @@ public class Pet { * pet status in the store * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Tag.java index 47799f61395..adac882cd05 100644 --- a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/Tag.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Tag id(Long id) { @@ -26,7 +28,7 @@ public class Tag { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Tag { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/User.java b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/User.java index dc119d03edf..4e5d397b990 100644 --- a/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-no-nullable/app/apimodels/User.java @@ -12,27 +12,35 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") + private Long id; @JsonProperty("username") + private String username; @JsonProperty("firstName") + private String firstName; @JsonProperty("lastName") + private String lastName; @JsonProperty("email") + private String email; @JsonProperty("password") + private String password; @JsonProperty("phone") + private String phone; @JsonProperty("userStatus") + private Integer userStatus; public User id(Long id) { @@ -44,7 +52,7 @@ public class User { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -61,7 +69,7 @@ public class User { * Get username * @return username **/ - public String getUsername() { + public String getUsername() { return username; } @@ -78,7 +86,7 @@ public class User { * Get firstName * @return firstName **/ - public String getFirstName() { + public String getFirstName() { return firstName; } @@ -95,7 +103,7 @@ public class User { * Get lastName * @return lastName **/ - public String getLastName() { + public String getLastName() { return lastName; } @@ -112,7 +120,7 @@ public class User { * Get email * @return email **/ - public String getEmail() { + public String getEmail() { return email; } @@ -129,7 +137,7 @@ public class User { * Get password * @return password **/ - public String getPassword() { + public String getPassword() { return password; } @@ -146,7 +154,7 @@ public class User { * Get phone * @return phone **/ - public String getPhone() { + public String getPhone() { return phone; } @@ -163,7 +171,7 @@ public class User { * User Status * @return userStatus **/ - public Integer getUserStatus() { + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/java-play-framework-no-nullable/build.sbt b/samples/server/petstore/java-play-framework-no-nullable/build.sbt index 83a17e91013..b972893fc3f 100644 --- a/samples/server/petstore/java-play-framework-no-nullable/build.sbt +++ b/samples/server/petstore/java-play-framework-no-nullable/build.sbt @@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.12.6" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5" -libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" +libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final" libraryDependencies += guice diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Category.java index c6f15ca13c3..afed4d545a9 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Category.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Category id(Long id) { @@ -26,7 +28,7 @@ public class Category { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Category { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/ModelApiResponse.java index b99eabed6fd..820779a1cd9 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/ModelApiResponse.java @@ -12,12 +12,15 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") + private Integer code; @JsonProperty("type") + private String type; @JsonProperty("message") + private String message; public ModelApiResponse code(Integer code) { @@ -29,7 +32,7 @@ public class ModelApiResponse { * Get code * @return code **/ - public Integer getCode() { + public Integer getCode() { return code; } @@ -46,7 +49,7 @@ public class ModelApiResponse { * Get type * @return type **/ - public String getType() { + public String getType() { return type; } @@ -63,7 +66,7 @@ public class ModelApiResponse { * Get message * @return message **/ - public String getMessage() { + public String getMessage() { return message; } diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Order.java index 2d378562807..d54cba148ad 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Order.java @@ -13,15 +13,20 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") + private Long id; @JsonProperty("petId") + private Long petId; @JsonProperty("quantity") + private Integer quantity; @JsonProperty("shipDate") + @Valid + private OffsetDateTime shipDate; /** @@ -58,9 +63,11 @@ public class Order { } @JsonProperty("status") + private StatusEnum status; @JsonProperty("complete") + private Boolean complete = false; public Order id(Long id) { @@ -72,7 +79,7 @@ public class Order { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -89,7 +96,7 @@ public class Order { * Get petId * @return petId **/ - public Long getPetId() { + public Long getPetId() { return petId; } @@ -106,7 +113,7 @@ public class Order { * Get quantity * @return quantity **/ - public Integer getQuantity() { + public Integer getQuantity() { return quantity; } @@ -123,7 +130,6 @@ public class Order { * Get shipDate * @return shipDate **/ - @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -141,7 +147,7 @@ public class Order { * Order Status * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } @@ -158,7 +164,7 @@ public class Order { * Get complete * @return complete **/ - public Boolean getComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Pet.java index f6c95ac4e9e..4699f7235ed 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Pet.java @@ -16,18 +16,27 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") + private Long id; @JsonProperty("category") + @Valid + private Category category; @JsonProperty("name") + @NotNull + private String name; @JsonProperty("photoUrls") + @NotNull + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") + @Valid + private List tags = null; /** @@ -64,6 +73,7 @@ public class Pet { } @JsonProperty("status") + private StatusEnum status; public Pet id(Long id) { @@ -75,7 +85,7 @@ public class Pet { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -92,7 +102,6 @@ public class Pet { * Get category * @return category **/ - @Valid public Category getCategory() { return category; } @@ -110,7 +119,6 @@ public class Pet { * Get name * @return name **/ - @NotNull public String getName() { return name; } @@ -133,7 +141,6 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - @NotNull public List getPhotoUrls() { return photoUrls; } @@ -159,7 +166,6 @@ public class Pet { * Get tags * @return tags **/ - @Valid public List getTags() { return tags; } @@ -177,7 +183,7 @@ public class Pet { * pet status in the store * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Tag.java index 47799f61395..adac882cd05 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Tag.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Tag id(Long id) { @@ -26,7 +28,7 @@ public class Tag { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Tag { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/User.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/User.java index dc119d03edf..4e5d397b990 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/User.java @@ -12,27 +12,35 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") + private Long id; @JsonProperty("username") + private String username; @JsonProperty("firstName") + private String firstName; @JsonProperty("lastName") + private String lastName; @JsonProperty("email") + private String email; @JsonProperty("password") + private String password; @JsonProperty("phone") + private String phone; @JsonProperty("userStatus") + private Integer userStatus; public User id(Long id) { @@ -44,7 +52,7 @@ public class User { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -61,7 +69,7 @@ public class User { * Get username * @return username **/ - public String getUsername() { + public String getUsername() { return username; } @@ -78,7 +86,7 @@ public class User { * Get firstName * @return firstName **/ - public String getFirstName() { + public String getFirstName() { return firstName; } @@ -95,7 +103,7 @@ public class User { * Get lastName * @return lastName **/ - public String getLastName() { + public String getLastName() { return lastName; } @@ -112,7 +120,7 @@ public class User { * Get email * @return email **/ - public String getEmail() { + public String getEmail() { return email; } @@ -129,7 +137,7 @@ public class User { * Get password * @return password **/ - public String getPassword() { + public String getPassword() { return password; } @@ -146,7 +154,7 @@ public class User { * Get phone * @return phone **/ - public String getPhone() { + public String getPhone() { return phone; } @@ -163,7 +171,7 @@ public class User { * User Status * @return userStatus **/ - public Integer getUserStatus() { + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/build.sbt b/samples/server/petstore/java-play-framework-no-swagger-ui/build.sbt index 2b56ff7331c..45bebc24cf0 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/build.sbt +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/build.sbt @@ -6,5 +6,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.12.6" -libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" +libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final" libraryDependencies += guice diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Category.java index c6f15ca13c3..afed4d545a9 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Category.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Category id(Long id) { @@ -26,7 +28,7 @@ public class Category { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Category { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/ModelApiResponse.java index b99eabed6fd..820779a1cd9 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/ModelApiResponse.java @@ -12,12 +12,15 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") + private Integer code; @JsonProperty("type") + private String type; @JsonProperty("message") + private String message; public ModelApiResponse code(Integer code) { @@ -29,7 +32,7 @@ public class ModelApiResponse { * Get code * @return code **/ - public Integer getCode() { + public Integer getCode() { return code; } @@ -46,7 +49,7 @@ public class ModelApiResponse { * Get type * @return type **/ - public String getType() { + public String getType() { return type; } @@ -63,7 +66,7 @@ public class ModelApiResponse { * Get message * @return message **/ - public String getMessage() { + public String getMessage() { return message; } diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Order.java index 2d378562807..d54cba148ad 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Order.java @@ -13,15 +13,20 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") + private Long id; @JsonProperty("petId") + private Long petId; @JsonProperty("quantity") + private Integer quantity; @JsonProperty("shipDate") + @Valid + private OffsetDateTime shipDate; /** @@ -58,9 +63,11 @@ public class Order { } @JsonProperty("status") + private StatusEnum status; @JsonProperty("complete") + private Boolean complete = false; public Order id(Long id) { @@ -72,7 +79,7 @@ public class Order { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -89,7 +96,7 @@ public class Order { * Get petId * @return petId **/ - public Long getPetId() { + public Long getPetId() { return petId; } @@ -106,7 +113,7 @@ public class Order { * Get quantity * @return quantity **/ - public Integer getQuantity() { + public Integer getQuantity() { return quantity; } @@ -123,7 +130,6 @@ public class Order { * Get shipDate * @return shipDate **/ - @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -141,7 +147,7 @@ public class Order { * Order Status * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } @@ -158,7 +164,7 @@ public class Order { * Get complete * @return complete **/ - public Boolean getComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Pet.java index f6c95ac4e9e..4699f7235ed 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Pet.java @@ -16,18 +16,27 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") + private Long id; @JsonProperty("category") + @Valid + private Category category; @JsonProperty("name") + @NotNull + private String name; @JsonProperty("photoUrls") + @NotNull + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") + @Valid + private List tags = null; /** @@ -64,6 +73,7 @@ public class Pet { } @JsonProperty("status") + private StatusEnum status; public Pet id(Long id) { @@ -75,7 +85,7 @@ public class Pet { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -92,7 +102,6 @@ public class Pet { * Get category * @return category **/ - @Valid public Category getCategory() { return category; } @@ -110,7 +119,6 @@ public class Pet { * Get name * @return name **/ - @NotNull public String getName() { return name; } @@ -133,7 +141,6 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - @NotNull public List getPhotoUrls() { return photoUrls; } @@ -159,7 +166,6 @@ public class Pet { * Get tags * @return tags **/ - @Valid public List getTags() { return tags; } @@ -177,7 +183,7 @@ public class Pet { * pet status in the store * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Tag.java index 47799f61395..adac882cd05 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Tag.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Tag id(Long id) { @@ -26,7 +28,7 @@ public class Tag { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Tag { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/User.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/User.java index dc119d03edf..4e5d397b990 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/User.java @@ -12,27 +12,35 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") + private Long id; @JsonProperty("username") + private String username; @JsonProperty("firstName") + private String firstName; @JsonProperty("lastName") + private String lastName; @JsonProperty("email") + private String email; @JsonProperty("password") + private String password; @JsonProperty("phone") + private String phone; @JsonProperty("userStatus") + private Integer userStatus; public User id(Long id) { @@ -44,7 +52,7 @@ public class User { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -61,7 +69,7 @@ public class User { * Get username * @return username **/ - public String getUsername() { + public String getUsername() { return username; } @@ -78,7 +86,7 @@ public class User { * Get firstName * @return firstName **/ - public String getFirstName() { + public String getFirstName() { return firstName; } @@ -95,7 +103,7 @@ public class User { * Get lastName * @return lastName **/ - public String getLastName() { + public String getLastName() { return lastName; } @@ -112,7 +120,7 @@ public class User { * Get email * @return email **/ - public String getEmail() { + public String getEmail() { return email; } @@ -129,7 +137,7 @@ public class User { * Get password * @return password **/ - public String getPassword() { + public String getPassword() { return password; } @@ -146,7 +154,7 @@ public class User { * Get phone * @return phone **/ - public String getPhone() { + public String getPhone() { return phone; } @@ -163,7 +171,7 @@ public class User { * User Status * @return userStatus **/ - public Integer getUserStatus() { + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/build.sbt b/samples/server/petstore/java-play-framework-no-wrap-calls/build.sbt index 83a17e91013..b972893fc3f 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/build.sbt +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/build.sbt @@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.12.6" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5" -libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" +libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final" libraryDependencies += guice diff --git a/samples/server/petstore/java-play-framework/app/apimodels/Category.java b/samples/server/petstore/java-play-framework/app/apimodels/Category.java index c6f15ca13c3..afed4d545a9 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/Category.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Category id(Long id) { @@ -26,7 +28,7 @@ public class Category { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Category { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework/app/apimodels/ModelApiResponse.java index b99eabed6fd..820779a1cd9 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/ModelApiResponse.java @@ -12,12 +12,15 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") + private Integer code; @JsonProperty("type") + private String type; @JsonProperty("message") + private String message; public ModelApiResponse code(Integer code) { @@ -29,7 +32,7 @@ public class ModelApiResponse { * Get code * @return code **/ - public Integer getCode() { + public Integer getCode() { return code; } @@ -46,7 +49,7 @@ public class ModelApiResponse { * Get type * @return type **/ - public String getType() { + public String getType() { return type; } @@ -63,7 +66,7 @@ public class ModelApiResponse { * Get message * @return message **/ - public String getMessage() { + public String getMessage() { return message; } diff --git a/samples/server/petstore/java-play-framework/app/apimodels/Order.java b/samples/server/petstore/java-play-framework/app/apimodels/Order.java index 2d378562807..d54cba148ad 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/Order.java @@ -13,15 +13,20 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") + private Long id; @JsonProperty("petId") + private Long petId; @JsonProperty("quantity") + private Integer quantity; @JsonProperty("shipDate") + @Valid + private OffsetDateTime shipDate; /** @@ -58,9 +63,11 @@ public class Order { } @JsonProperty("status") + private StatusEnum status; @JsonProperty("complete") + private Boolean complete = false; public Order id(Long id) { @@ -72,7 +79,7 @@ public class Order { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -89,7 +96,7 @@ public class Order { * Get petId * @return petId **/ - public Long getPetId() { + public Long getPetId() { return petId; } @@ -106,7 +113,7 @@ public class Order { * Get quantity * @return quantity **/ - public Integer getQuantity() { + public Integer getQuantity() { return quantity; } @@ -123,7 +130,6 @@ public class Order { * Get shipDate * @return shipDate **/ - @Valid public OffsetDateTime getShipDate() { return shipDate; } @@ -141,7 +147,7 @@ public class Order { * Order Status * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } @@ -158,7 +164,7 @@ public class Order { * Get complete * @return complete **/ - public Boolean getComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-play-framework/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework/app/apimodels/Pet.java index f6c95ac4e9e..4699f7235ed 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/Pet.java @@ -16,18 +16,27 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") + private Long id; @JsonProperty("category") + @Valid + private Category category; @JsonProperty("name") + @NotNull + private String name; @JsonProperty("photoUrls") + @NotNull + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") + @Valid + private List tags = null; /** @@ -64,6 +73,7 @@ public class Pet { } @JsonProperty("status") + private StatusEnum status; public Pet id(Long id) { @@ -75,7 +85,7 @@ public class Pet { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -92,7 +102,6 @@ public class Pet { * Get category * @return category **/ - @Valid public Category getCategory() { return category; } @@ -110,7 +119,6 @@ public class Pet { * Get name * @return name **/ - @NotNull public String getName() { return name; } @@ -133,7 +141,6 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - @NotNull public List getPhotoUrls() { return photoUrls; } @@ -159,7 +166,6 @@ public class Pet { * Get tags * @return tags **/ - @Valid public List getTags() { return tags; } @@ -177,7 +183,7 @@ public class Pet { * pet status in the store * @return status **/ - public StatusEnum getStatus() { + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/java-play-framework/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework/app/apimodels/Tag.java index 47799f61395..adac882cd05 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/Tag.java @@ -12,9 +12,11 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") + private Long id; @JsonProperty("name") + private String name; public Tag id(Long id) { @@ -26,7 +28,7 @@ public class Tag { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -43,7 +45,7 @@ public class Tag { * Get name * @return name **/ - public String getName() { + public String getName() { return name; } diff --git a/samples/server/petstore/java-play-framework/app/apimodels/User.java b/samples/server/petstore/java-play-framework/app/apimodels/User.java index dc119d03edf..4e5d397b990 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/User.java @@ -12,27 +12,35 @@ import javax.validation.constraints.*; @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") + private Long id; @JsonProperty("username") + private String username; @JsonProperty("firstName") + private String firstName; @JsonProperty("lastName") + private String lastName; @JsonProperty("email") + private String email; @JsonProperty("password") + private String password; @JsonProperty("phone") + private String phone; @JsonProperty("userStatus") + private Integer userStatus; public User id(Long id) { @@ -44,7 +52,7 @@ public class User { * Get id * @return id **/ - public Long getId() { + public Long getId() { return id; } @@ -61,7 +69,7 @@ public class User { * Get username * @return username **/ - public String getUsername() { + public String getUsername() { return username; } @@ -78,7 +86,7 @@ public class User { * Get firstName * @return firstName **/ - public String getFirstName() { + public String getFirstName() { return firstName; } @@ -95,7 +103,7 @@ public class User { * Get lastName * @return lastName **/ - public String getLastName() { + public String getLastName() { return lastName; } @@ -112,7 +120,7 @@ public class User { * Get email * @return email **/ - public String getEmail() { + public String getEmail() { return email; } @@ -129,7 +137,7 @@ public class User { * Get password * @return password **/ - public String getPassword() { + public String getPassword() { return password; } @@ -146,7 +154,7 @@ public class User { * Get phone * @return phone **/ - public String getPhone() { + public String getPhone() { return phone; } @@ -163,7 +171,7 @@ public class User { * User Status * @return userStatus **/ - public Integer getUserStatus() { + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/java-play-framework/build.sbt b/samples/server/petstore/java-play-framework/build.sbt index 83a17e91013..b972893fc3f 100644 --- a/samples/server/petstore/java-play-framework/build.sbt +++ b/samples/server/petstore/java-play-framework/build.sbt @@ -7,5 +7,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.12.6" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5" -libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" +libraryDependencies += "javax.validation" % "validation-api" % "2.0.1.Final" libraryDependencies += guice From 0068932470d46c9b863e39ebcb34b0438eca523a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sat, 23 Jan 2021 14:16:41 +0800 Subject: [PATCH 22/54] fix Parcelable option (#8513) --- .../codegen/languages/JavaClientCodegen.java | 46 +++++++++---------- .../docs/AdditionalPropertiesAnyType.md | 4 ++ .../docs/AdditionalPropertiesArray.md | 4 ++ .../docs/AdditionalPropertiesBoolean.md | 4 ++ .../docs/AdditionalPropertiesClass.md | 4 ++ .../docs/AdditionalPropertiesInteger.md | 4 ++ .../docs/AdditionalPropertiesNumber.md | 4 ++ .../docs/AdditionalPropertiesObject.md | 4 ++ .../docs/AdditionalPropertiesString.md | 4 ++ .../docs/Animal.md | 4 ++ .../docs/ArrayOfArrayOfNumberOnly.md | 4 ++ .../docs/ArrayOfNumberOnly.md | 4 ++ .../docs/ArrayTest.md | 4 ++ .../docs/BigCat.md | 4 ++ .../docs/BigCatAllOf.md | 4 ++ .../docs/Capitalization.md | 4 ++ .../okhttp-gson-parcelableModel/docs/Cat.md | 4 ++ .../docs/CatAllOf.md | 4 ++ .../docs/Category.md | 4 ++ .../docs/ClassModel.md | 4 ++ .../docs/Client.md | 4 ++ .../okhttp-gson-parcelableModel/docs/Dog.md | 4 ++ .../docs/DogAllOf.md | 4 ++ .../docs/EnumArrays.md | 4 ++ .../docs/EnumTest.md | 4 ++ .../docs/FileSchemaTestClass.md | 4 ++ .../docs/FormatTest.md | 4 ++ .../docs/HasOnlyReadOnly.md | 4 ++ .../docs/MapTest.md | 4 ++ ...dPropertiesAndAdditionalPropertiesClass.md | 4 ++ .../docs/Model200Response.md | 4 ++ .../docs/ModelApiResponse.md | 4 ++ .../docs/ModelReturn.md | 4 ++ .../okhttp-gson-parcelableModel/docs/Name.md | 4 ++ .../docs/NumberOnly.md | 4 ++ .../okhttp-gson-parcelableModel/docs/Order.md | 4 ++ .../docs/OuterComposite.md | 4 ++ .../okhttp-gson-parcelableModel/docs/Pet.md | 4 ++ .../docs/ReadOnlyFirst.md | 4 ++ .../docs/SpecialModelName.md | 4 ++ .../okhttp-gson-parcelableModel/docs/Tag.md | 4 ++ .../docs/TypeHolderDefault.md | 4 ++ .../docs/TypeHolderExample.md | 4 ++ .../okhttp-gson-parcelableModel/docs/User.md | 4 ++ .../docs/XmlItem.md | 4 ++ .../model/AdditionalPropertiesAnyType.java | 2 +- .../model/AdditionalPropertiesArray.java | 2 +- .../model/AdditionalPropertiesBoolean.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/AdditionalPropertiesInteger.java | 2 +- .../model/AdditionalPropertiesNumber.java | 2 +- .../model/AdditionalPropertiesObject.java | 2 +- .../model/AdditionalPropertiesString.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 2 +- .../org/openapitools/client/model/BigCat.java | 2 +- .../client/model/BigCatAllOf.java | 2 +- .../client/model/Capitalization.java | 2 +- .../org/openapitools/client/model/Cat.java | 2 +- .../openapitools/client/model/CatAllOf.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../openapitools/client/model/ClassModel.java | 2 +- .../org/openapitools/client/model/Client.java | 2 +- .../org/openapitools/client/model/Dog.java | 2 +- .../openapitools/client/model/DogAllOf.java | 2 +- .../openapitools/client/model/EnumArrays.java | 2 +- .../openapitools/client/model/EnumTest.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/FormatTest.java | 2 +- .../client/model/HasOnlyReadOnly.java | 2 +- .../openapitools/client/model/MapTest.java | 2 +- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../client/model/Model200Response.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../client/model/ModelReturn.java | 2 +- .../org/openapitools/client/model/Name.java | 2 +- .../openapitools/client/model/NumberOnly.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../client/model/OuterComposite.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../client/model/ReadOnlyFirst.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../openapitools/client/model/XmlItem.java | 2 +- 89 files changed, 243 insertions(+), 67 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index f7053bd900c..ce2c5a61180 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -855,35 +855,35 @@ public class JavaClientCodegen extends AbstractJavaCodegen } } } + } - // add implements for serializable/parcelable to all models - for (Object _mo : models) { - Map mo = (Map) _mo; - CodegenModel cm = (CodegenModel) mo.get("model"); + // add implements for serializable/parcelable to all models + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel cm = (CodegenModel) mo.get("model"); - cm.getVendorExtensions().putIfAbsent("x-implements", new ArrayList()); - if (JERSEY2.equals(getLibrary()) || NATIVE.equals(getLibrary())) { - cm.getVendorExtensions().put("x-implements", new ArrayList()); + cm.getVendorExtensions().putIfAbsent("x-implements", new ArrayList()); + if (JERSEY2.equals(getLibrary()) || NATIVE.equals(getLibrary())) { + cm.getVendorExtensions().put("x-implements", new ArrayList()); - if (cm.oneOf != null && !cm.oneOf.isEmpty() && cm.oneOf.contains("ModelNull")) { - // if oneOf contains "null" type - cm.isNullable = true; - cm.oneOf.remove("ModelNull"); - } - - if (cm.anyOf != null && !cm.anyOf.isEmpty() && cm.anyOf.contains("ModelNull")) { - // if anyOf contains "null" type - cm.isNullable = true; - cm.anyOf.remove("ModelNull"); - } + if (cm.oneOf != null && !cm.oneOf.isEmpty() && cm.oneOf.contains("ModelNull")) { + // if oneOf contains "null" type + cm.isNullable = true; + cm.oneOf.remove("ModelNull"); } - if (this.parcelableModel) { - ((ArrayList) cm.getVendorExtensions().get("x-implements")).add("Parcelable"); - } - if (this.serializableModel) { - ((ArrayList) cm.getVendorExtensions().get("x-implements")).add("Serializable"); + + if (cm.anyOf != null && !cm.anyOf.isEmpty() && cm.anyOf.contains("ModelNull")) { + // if anyOf contains "null" type + cm.isNullable = true; + cm.anyOf.remove("ModelNull"); } } + if (this.parcelableModel) { + ((ArrayList) cm.getVendorExtensions().get("x-implements")).add("Parcelable"); + } + if (this.serializableModel) { + ((ArrayList) cm.getVendorExtensions().get("x-implements")).add("Serializable"); + } } return objs; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesAnyType.md index 87b468bb7ca..34c14b52bf2 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesAnyType.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesAnyType.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **name** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesArray.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesArray.md index cb7fe9b3903..6a791da7106 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesArray.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesArray.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **name** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesBoolean.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesBoolean.md index 6b53e7ba73a..930bfd1a5ac 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesBoolean.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesBoolean.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **name** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesClass.md index f9e189355cf..e3b04c897ed 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesClass.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesClass.md @@ -19,4 +19,8 @@ Name | Type | Description | Notes **anytype3** | **Object** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesInteger.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesInteger.md index d2ed7fb1a46..7629f5f50c8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesInteger.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesInteger.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **name** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesNumber.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesNumber.md index 53f6e81e717..6a745f35b63 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesNumber.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesNumber.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **name** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesObject.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesObject.md index 98ac8d2e5fe..060b7bdd6c0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesObject.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesObject.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **name** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesString.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesString.md index d7970cdfe19..5b0385e52a0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesString.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/AdditionalPropertiesString.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **name** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Animal.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Animal.md index c8e18ae55e4..cd162bd797d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Animal.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Animal.md @@ -10,4 +10,8 @@ Name | Type | Description | Notes **color** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfArrayOfNumberOnly.md index e1a0e54c0b5..e6071b7ac6a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfArrayOfNumberOnly.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfArrayOfNumberOnly.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **arrayArrayNumber** | **List<List<BigDecimal>>** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfNumberOnly.md index 25670a603c4..103babddf1b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfNumberOnly.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayOfNumberOnly.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **arrayNumber** | **List<BigDecimal>** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayTest.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayTest.md index 7c6f6245ac8..1b79b1e97df 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayTest.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ArrayTest.md @@ -11,4 +11,8 @@ Name | Type | Description | Notes **arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCat.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCat.md index 8a075304abf..eec91a45802 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCat.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCat.md @@ -20,4 +20,8 @@ LEOPARDS | "leopards" JAGUARS | "jaguars" +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCatAllOf.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCatAllOf.md index 21177dbf089..d4c713b3e96 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCatAllOf.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCatAllOf.md @@ -20,4 +20,8 @@ LEOPARDS | "leopards" JAGUARS | "jaguars" +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Capitalization.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Capitalization.md index 7b73c40b554..d7b56a6b99c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Capitalization.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Capitalization.md @@ -14,4 +14,8 @@ Name | Type | Description | Notes **ATT_NAME** | **String** | Name of the pet | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Cat.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Cat.md index 39c2f864df8..7c35c8fdba5 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Cat.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Cat.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **declawed** | **Boolean** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/CatAllOf.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/CatAllOf.md index 1098fd900c5..c8b10048700 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/CatAllOf.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/CatAllOf.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **declawed** | **Boolean** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Category.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Category.md index 613ea9f7ee2..eaa76f6bb22 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Category.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Category.md @@ -10,4 +10,8 @@ Name | Type | Description | Notes **name** | **String** | | +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ClassModel.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ClassModel.md index d5453c20133..ede422e87c2 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ClassModel.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ClassModel.md @@ -10,4 +10,8 @@ Name | Type | Description | Notes **propertyClass** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Client.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Client.md index 228df492383..149537224cc 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Client.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Client.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **client** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Dog.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Dog.md index 73cedf2bc91..ffb0e9d2dc0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Dog.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Dog.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **breed** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/DogAllOf.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/DogAllOf.md index cbeb9e9a22d..1ed266a241d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/DogAllOf.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/DogAllOf.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **breed** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumArrays.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumArrays.md index 869b7a6c066..f1193deea42 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumArrays.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumArrays.md @@ -28,4 +28,8 @@ FISH | "fish" CRAB | "crab" +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumTest.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumTest.md index e066d77e5b0..5b0880f6c25 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumTest.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumTest.md @@ -51,4 +51,8 @@ NUMBER_1_DOT_1 | 1.1 NUMBER_MINUS_1_DOT_2 | -1.2 +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FileSchemaTestClass.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FileSchemaTestClass.md index 3a95e27d7c0..69ba61e421b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FileSchemaTestClass.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FileSchemaTestClass.md @@ -10,4 +10,8 @@ Name | Type | Description | Notes **files** | [**List<java.io.File>**](java.io.File.md) | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FormatTest.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FormatTest.md index 60fa4300013..ea86e5d595c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FormatTest.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FormatTest.md @@ -22,4 +22,8 @@ Name | Type | Description | Notes **bigDecimal** | **BigDecimal** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/HasOnlyReadOnly.md index 4795b40ef65..b79bfb108f5 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/HasOnlyReadOnly.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/HasOnlyReadOnly.md @@ -10,4 +10,8 @@ Name | Type | Description | Notes **foo** | **String** | | [optional] [readonly] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MapTest.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MapTest.md index 9c3aeb6495c..575e33afaaf 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MapTest.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MapTest.md @@ -21,4 +21,8 @@ UPPER | "UPPER" LOWER | "lower" +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MixedPropertiesAndAdditionalPropertiesClass.md index 52d10b2cc7a..68afad173e8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -11,4 +11,8 @@ Name | Type | Description | Notes **map** | [**Map<String, Animal>**](Animal.md) | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Model200Response.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Model200Response.md index f9928d70622..9ba2d6a0f9c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Model200Response.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Model200Response.md @@ -11,4 +11,8 @@ Name | Type | Description | Notes **propertyClass** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ModelApiResponse.md index 14fb7f1ed27..02b3abc589e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ModelApiResponse.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ModelApiResponse.md @@ -11,4 +11,8 @@ Name | Type | Description | Notes **message** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ModelReturn.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ModelReturn.md index 5005d4b7239..44ef6c4dfcb 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ModelReturn.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ModelReturn.md @@ -10,4 +10,8 @@ Name | Type | Description | Notes **_return** | **Integer** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Name.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Name.md index b815a0b4c99..d439eec4bb6 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Name.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Name.md @@ -13,4 +13,8 @@ Name | Type | Description | Notes **_123number** | **Integer** | | [optional] [readonly] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/NumberOnly.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/NumberOnly.md index 4b9d048546c..982360b302c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/NumberOnly.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/NumberOnly.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **justNumber** | **BigDecimal** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Order.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Order.md index 30782d6ae77..3a50641dde8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Order.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Order.md @@ -24,4 +24,8 @@ APPROVED | "approved" DELIVERED | "delivered" +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/OuterComposite.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/OuterComposite.md index 594951145a3..f539125ebe3 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/OuterComposite.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/OuterComposite.md @@ -11,4 +11,8 @@ Name | Type | Description | Notes **myBoolean** | **Boolean** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Pet.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Pet.md index bdcdad6b3e6..932bd08f0c5 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Pet.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Pet.md @@ -24,4 +24,8 @@ PENDING | "pending" SOLD | "sold" +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ReadOnlyFirst.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ReadOnlyFirst.md index a692499dc66..5702a47fb52 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ReadOnlyFirst.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ReadOnlyFirst.md @@ -10,4 +10,8 @@ Name | Type | Description | Notes **baz** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/SpecialModelName.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/SpecialModelName.md index 934b8f0f25d..ec66e930bdf 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/SpecialModelName.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/SpecialModelName.md @@ -9,4 +9,8 @@ Name | Type | Description | Notes **$specialPropertyName** | **Long** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Tag.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Tag.md index f24eba7d222..0bb43f42f24 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Tag.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Tag.md @@ -10,4 +10,8 @@ Name | Type | Description | Notes **name** | **String** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/TypeHolderDefault.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/TypeHolderDefault.md index e28c7a9df58..5c4a6f50d15 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/TypeHolderDefault.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/TypeHolderDefault.md @@ -13,4 +13,8 @@ Name | Type | Description | Notes **arrayItem** | **List<Integer>** | | +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/TypeHolderExample.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/TypeHolderExample.md index 96f0d4bebf4..76de8235c8a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/TypeHolderExample.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/TypeHolderExample.md @@ -14,4 +14,8 @@ Name | Type | Description | Notes **arrayItem** | **List<Integer>** | | +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/User.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/User.md index c4ea94b7fc1..76046312d5d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/User.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/User.md @@ -16,4 +16,8 @@ Name | Type | Description | Notes **userStatus** | **Integer** | User Status | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/XmlItem.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/XmlItem.md index 096fdc7b09a..06b218877b2 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/XmlItem.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/XmlItem.md @@ -37,4 +37,8 @@ Name | Type | Description | Notes **prefixNsWrappedArray** | **List<Integer>** | | [optional] +## Implemented Interfaces + +* Parcelable + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 500c70c324c..a13fc98ec82 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -32,7 +32,7 @@ import android.os.Parcel; * AdditionalPropertiesAnyType */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class AdditionalPropertiesAnyType extends HashMap { +public class AdditionalPropertiesAnyType extends HashMap implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) private String name; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index cc89ddd2ac6..d784e0ca721 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -33,7 +33,7 @@ import android.os.Parcel; * AdditionalPropertiesArray */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class AdditionalPropertiesArray extends HashMap { +public class AdditionalPropertiesArray extends HashMap implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) private String name; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index fa580c5be82..e44d751debb 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -32,7 +32,7 @@ import android.os.Parcel; * AdditionalPropertiesBoolean */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class AdditionalPropertiesBoolean extends HashMap { +public class AdditionalPropertiesBoolean extends HashMap implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) private String name; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 95a60c8d07c..8de35356fdd 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -34,7 +34,7 @@ import android.os.Parcel; * AdditionalPropertiesClass */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class AdditionalPropertiesClass { +public class AdditionalPropertiesClass implements Parcelable { public static final String SERIALIZED_NAME_MAP_STRING = "map_string"; @SerializedName(SERIALIZED_NAME_MAP_STRING) private Map mapString = null; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index a2c86e65a21..fdbe11cac79 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -32,7 +32,7 @@ import android.os.Parcel; * AdditionalPropertiesInteger */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class AdditionalPropertiesInteger extends HashMap { +public class AdditionalPropertiesInteger extends HashMap implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) private String name; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index f9df8bbb0ce..f8cab5ec5b6 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -33,7 +33,7 @@ import android.os.Parcel; * AdditionalPropertiesNumber */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class AdditionalPropertiesNumber extends HashMap { +public class AdditionalPropertiesNumber extends HashMap implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) private String name; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 9fed1ee5313..56c71a6a9ed 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -32,7 +32,7 @@ import android.os.Parcel; * AdditionalPropertiesObject */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class AdditionalPropertiesObject extends HashMap { +public class AdditionalPropertiesObject extends HashMap implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) private String name; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index b0b59b28b1c..390a9ebd743 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -32,7 +32,7 @@ import android.os.Parcel; * AdditionalPropertiesString */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class AdditionalPropertiesString extends HashMap { +public class AdditionalPropertiesString extends HashMap implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) private String name; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java index 1ce96ba982a..c4d1f9b70a1 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java @@ -33,7 +33,7 @@ import android.os.Parcel; * Animal */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Animal { +public class Animal implements Parcelable { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) protected String className; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 18d1d5c0feb..130c21c2bed 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -33,7 +33,7 @@ import android.os.Parcel; * ArrayOfArrayOfNumberOnly */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ArrayOfArrayOfNumberOnly { +public class ArrayOfArrayOfNumberOnly implements Parcelable { public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER) private List> arrayArrayNumber = null; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 522be04febc..30853ddef9c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -33,7 +33,7 @@ import android.os.Parcel; * ArrayOfNumberOnly */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ArrayOfNumberOnly { +public class ArrayOfNumberOnly implements Parcelable { public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber"; @SerializedName(SERIALIZED_NAME_ARRAY_NUMBER) private List arrayNumber = null; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java index 81d699bb0ee..02e3c16dc07 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -33,7 +33,7 @@ import android.os.Parcel; * ArrayTest */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ArrayTest { +public class ArrayTest implements Parcelable { public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string"; @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRING) private List arrayOfString = null; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java index 2dba2d3dcf3..b3bfe4db44c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java @@ -32,7 +32,7 @@ import android.os.Parcel; * BigCat */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BigCat extends Cat { +public class BigCat extends Cat implements Parcelable { /** * Gets or Sets kind */ diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 01c3dc8eb8e..c3f3dc8a3b3 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -30,7 +30,7 @@ import android.os.Parcel; * BigCatAllOf */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BigCatAllOf { +public class BigCatAllOf implements Parcelable { /** * Gets or Sets kind */ diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java index 92162a57b3d..bfe3ff75cb5 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java @@ -30,7 +30,7 @@ import android.os.Parcel; * Capitalization */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Capitalization { +public class Capitalization implements Parcelable { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) private String smallCamel; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java index 19b4eea504a..d6b5706842e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java @@ -33,7 +33,7 @@ import android.os.Parcel; * Cat */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Cat extends Animal { +public class Cat extends Animal implements Parcelable { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) private Boolean declawed; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java index 0f2d9b4bcc8..f6bf94ab8bb 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -30,7 +30,7 @@ import android.os.Parcel; * CatAllOf */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class CatAllOf { +public class CatAllOf implements Parcelable { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) private Boolean declawed; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java index 8f6dbc06f4f..ff45f7a9f74 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java @@ -30,7 +30,7 @@ import android.os.Parcel; * Category */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Category { +public class Category implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) private Long id; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java index 40b621a3b1e..3da89295c1d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java @@ -31,7 +31,7 @@ import android.os.Parcel; */ @ApiModel(description = "Model for testing model with \"_class\" property") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ClassModel { +public class ClassModel implements Parcelable { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) private String propertyClass; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java index fb62051922b..b3dcf5f42fc 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java @@ -30,7 +30,7 @@ import android.os.Parcel; * Client */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Client { +public class Client implements Parcelable { public static final String SERIALIZED_NAME_CLIENT = "client"; @SerializedName(SERIALIZED_NAME_CLIENT) private String client; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java index 3e9bd60bd0c..fee3a8d69ba 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java @@ -32,7 +32,7 @@ import android.os.Parcel; * Dog */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Dog extends Animal { +public class Dog extends Animal implements Parcelable { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) private String breed; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java index 105f23c212c..67827960399 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -30,7 +30,7 @@ import android.os.Parcel; * DogAllOf */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class DogAllOf { +public class DogAllOf implements Parcelable { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) private String breed; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java index 9cd622349b1..868faf2ecd4 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -32,7 +32,7 @@ import android.os.Parcel; * EnumArrays */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class EnumArrays { +public class EnumArrays implements Parcelable { /** * Gets or Sets justSymbol */ diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java index 8d67cd0c12a..6d4158f0d1a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java @@ -31,7 +31,7 @@ import android.os.Parcel; * EnumTest */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class EnumTest { +public class EnumTest implements Parcelable { /** * Gets or Sets enumString */ diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 17d2bc90ce2..ec96d3a7a7b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -32,7 +32,7 @@ import android.os.Parcel; * FileSchemaTestClass */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FileSchemaTestClass { +public class FileSchemaTestClass implements Parcelable { public static final String SERIALIZED_NAME_FILE = "file"; @SerializedName(SERIALIZED_NAME_FILE) private java.io.File file; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java index 575b8ba5d9b..6386fce4e3a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java @@ -35,7 +35,7 @@ import android.os.Parcel; * FormatTest */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FormatTest { +public class FormatTest implements Parcelable { public static final String SERIALIZED_NAME_INTEGER = "integer"; @SerializedName(SERIALIZED_NAME_INTEGER) private Integer integer; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 2c83f5debb5..dd1898652d6 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ import android.os.Parcel; * HasOnlyReadOnly */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class HasOnlyReadOnly { +public class HasOnlyReadOnly implements Parcelable { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) private String bar; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java index e3b394e269c..bcba119dd25 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java @@ -33,7 +33,7 @@ import android.os.Parcel; * MapTest */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class MapTest { +public class MapTest implements Parcelable { public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string"; @SerializedName(SERIALIZED_NAME_MAP_MAP_OF_STRING) private Map> mapMapOfString = null; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index bf7d7f9c8b6..008238543f8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -36,7 +36,7 @@ import android.os.Parcel; * MixedPropertiesAndAdditionalPropertiesClass */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class MixedPropertiesAndAdditionalPropertiesClass { +public class MixedPropertiesAndAdditionalPropertiesClass implements Parcelable { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) private UUID uuid; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java index feffa9b3f70..9757756ee7d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java @@ -31,7 +31,7 @@ import android.os.Parcel; */ @ApiModel(description = "Model for testing model name starting with number") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Model200Response { +public class Model200Response implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) private Integer name; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 27c1e73ead0..991a0d9def4 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -30,7 +30,7 @@ import android.os.Parcel; * ModelApiResponse */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ModelApiResponse { +public class ModelApiResponse implements Parcelable { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) private Integer code; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java index e8f006b882b..92ceace88ea 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -31,7 +31,7 @@ import android.os.Parcel; */ @ApiModel(description = "Model for testing reserved words") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ModelReturn { +public class ModelReturn implements Parcelable { public static final String SERIALIZED_NAME_RETURN = "return"; @SerializedName(SERIALIZED_NAME_RETURN) private Integer _return; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java index 7c45b68af7c..f9df55d20d6 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java @@ -31,7 +31,7 @@ import android.os.Parcel; */ @ApiModel(description = "Model for testing model name same as property name") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Name { +public class Name implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) private Integer name; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java index 5420a2aabeb..9a19233a42c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -31,7 +31,7 @@ import android.os.Parcel; * NumberOnly */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class NumberOnly { +public class NumberOnly implements Parcelable { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @SerializedName(SERIALIZED_NAME_JUST_NUMBER) private BigDecimal justNumber; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java index 3a8ab2a1702..667e83cb197 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java @@ -31,7 +31,7 @@ import android.os.Parcel; * Order */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Order { +public class Order implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) private Long id; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java index 69bf96b3537..190d73706de 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -31,7 +31,7 @@ import android.os.Parcel; * OuterComposite */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class OuterComposite { +public class OuterComposite implements Parcelable { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @SerializedName(SERIALIZED_NAME_MY_NUMBER) private BigDecimal myNumber; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java index b10d8d054ce..a0cdfdab75e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java @@ -36,7 +36,7 @@ import android.os.Parcel; * Pet */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Pet { +public class Pet implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) private Long id; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 41d96314ef8..fc9f51316ab 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ import android.os.Parcel; * ReadOnlyFirst */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ReadOnlyFirst { +public class ReadOnlyFirst implements Parcelable { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) private String bar; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java index a65e7868fa2..e3d068f4c1f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -30,7 +30,7 @@ import android.os.Parcel; * SpecialModelName */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class SpecialModelName { +public class SpecialModelName implements Parcelable { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) private Long $specialPropertyName; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java index 98ae4043029..60fefc6701f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java @@ -30,7 +30,7 @@ import android.os.Parcel; * Tag */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Tag { +public class Tag implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) private Long id; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index c2fa377d0d9..4c29c6ab1ef 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -33,7 +33,7 @@ import android.os.Parcel; * TypeHolderDefault */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class TypeHolderDefault { +public class TypeHolderDefault implements Parcelable { public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; @SerializedName(SERIALIZED_NAME_STRING_ITEM) private String stringItem = "what"; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java index bf4a2d5a6cb..d18c289e067 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -33,7 +33,7 @@ import android.os.Parcel; * TypeHolderExample */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class TypeHolderExample { +public class TypeHolderExample implements Parcelable { public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; @SerializedName(SERIALIZED_NAME_STRING_ITEM) private String stringItem; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java index 6ba6e2adeb1..69ab1d83945 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java @@ -30,7 +30,7 @@ import android.os.Parcel; * User */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class User { +public class User implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) private Long id; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java index 7bcdd44ecc6..13887553ba2 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java @@ -33,7 +33,7 @@ import android.os.Parcel; * XmlItem */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class XmlItem { +public class XmlItem implements Parcelable { public static final String SERIALIZED_NAME_ATTRIBUTE_STRING = "attribute_string"; @SerializedName(SERIALIZED_NAME_ATTRIBUTE_STRING) private String attributeString; From 5f2ca618626ee15778a71e06211c4b02533fe951 Mon Sep 17 00:00:00 2001 From: Richard Whitehouse Date: Sat, 23 Jan 2021 21:32:51 +0000 Subject: [PATCH 23/54] [Core, Rust Server] anyOf / oneOf support for Rust Server (#6690) * [Core] Inline Model Resolution of Enums Enums need to be named types, so handle them as part of inline model resolution * [Rust Server] Handle models starting with a number correctly * [Rust Server] Additional trace * [Rust Server] Add support for oneOf/anyOf * [Rust Server] Update supported features * [Rust Server] General template tidy up * [Rust Server] Implement IntoHeaderValue for wrapped data types * [Rust Server] Convert from string correctly * [Rust Server] Test for anyOf/oneOf * Update samples * Update docs --- docs/generators/rust-server.md | 2 +- .../codegen/InlineModelResolver.java | 62 +- .../codegen/languages/RustServerCodegen.java | 39 +- .../resources/rust-server/models.mustache | 121 +- .../resources/rust-server/response.mustache | 2 +- .../resources/3_0/rust-server/openapi-v3.yaml | 74 +- .../java/feign/feign10x/api/openapi.yaml | 3 + .../multipart-v3/docs/MultipartRequest.md | 13 - .../output/multipart-v3/src/models.rs | 113 +- .../output/no-example-v3/src/models.rs | 79 +- .../openapi-v3/.openapi-generator/FILES | 5 + .../rust-server/output/openapi-v3/README.md | 9 + .../output/openapi-v3/api/openapi.yaml | 80 + .../output/openapi-v3/docs/AnyOfObject.md | 9 + .../openapi-v3/docs/AnyOfObjectAnyOf.md | 9 + .../output/openapi-v3/docs/AnyOfProperty.md | 11 + .../openapi-v3/docs/Model12345AnyOfObject.md | 9 + .../docs/Model12345AnyOfObjectAnyOf.md | 9 + .../output/openapi-v3/docs/default_api.md | 56 + .../output/openapi-v3/examples/client/main.rs | 15 + .../openapi-v3/examples/server/server.rs | 21 + .../output/openapi-v3/src/client/mod.rs | 181 ++ .../rust-server/output/openapi-v3/src/lib.rs | 58 + .../output/openapi-v3/src/models.rs | 1124 ++++++++---- .../output/openapi-v3/src/server/mod.rs | 162 +- .../rust-server/output/ops-v3/src/models.rs | 1 - .../src/models.rs | 1522 ++++++++--------- .../output/rust-server-test/src/models.rs | 257 ++- 28 files changed, 2554 insertions(+), 1492 deletions(-) delete mode 100644 samples/server/petstore/rust-server/output/multipart-v3/docs/MultipartRequest.md create mode 100644 samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfObject.md create mode 100644 samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfObjectAnyOf.md create mode 100644 samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfProperty.md create mode 100644 samples/server/petstore/rust-server/output/openapi-v3/docs/Model12345AnyOfObject.md create mode 100644 samples/server/petstore/rust-server/output/openapi-v3/docs/Model12345AnyOfObjectAnyOf.md diff --git a/docs/generators/rust-server.md b/docs/generators/rust-server.md index d24af6089b7..cadccd0fbcc 100644 --- a/docs/generators/rust-server.md +++ b/docs/generators/rust-server.md @@ -186,7 +186,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Name | Supported | Defined By | | ---- | --------- | ---------- | |Simple|✓|OAS2,OAS3 -|Composite|✗|OAS2,OAS3 +|Composite|✓|OAS2,OAS3 |Polymorphism|✗|OAS2,OAS3 |Union|✗|OAS3 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java index 40ab769081d..95aaf46b6fa 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java @@ -378,38 +378,34 @@ public class InlineModelResolver { ListIterator listIterator = children.listIterator(); while (listIterator.hasNext()) { Schema component = listIterator.next(); - if (component instanceof ObjectSchema || // for inline schema with type:object - (component != null && component.getProperties() != null && - !component.getProperties().isEmpty())) { // for inline schema without type:object - Schema op = component; - if (op.get$ref() == null && op.getProperties() != null && op.getProperties().size() > 0) { - // If a `title` attribute is defined in the inline schema, codegen uses it to name the - // inline schema. Otherwise, we'll use the default naming such as InlineObject1, etc. - // We know that this is not the best way to name the model. - // - // Such naming strategy may result in issues. If the value of the 'title' attribute - // happens to match a schema defined elsewhere in the specification, 'innerModelName' - // will be the same as that other schema. - // - // To have complete control of the model naming, one can define the model separately - // instead of inline. - String innerModelName = resolveModelName(op.getTitle(), key); - Schema innerModel = modelFromProperty(openAPI, op, innerModelName); - String existing = matchGenerated(innerModel); - if (existing == null) { - openAPI.getComponents().addSchemas(innerModelName, innerModel); - addGenerated(innerModelName, innerModel); - Schema schema = new Schema().$ref(innerModelName); - schema.setRequired(op.getRequired()); - listIterator.set(schema); - } else { - Schema schema = new Schema().$ref(existing); - schema.setRequired(op.getRequired()); - listIterator.set(schema); - } + if ((component != null) && + (component.get$ref() == null) && + ((component.getProperties() != null && !component.getProperties().isEmpty()) || + (component.getEnum() != null && !component.getEnum().isEmpty()))) { + // If a `title` attribute is defined in the inline schema, codegen uses it to name the + // inline schema. Otherwise, we'll use the default naming such as InlineObject1, etc. + // We know that this is not the best way to name the model. + // + // Such naming strategy may result in issues. If the value of the 'title' attribute + // happens to match a schema defined elsewhere in the specification, 'innerModelName' + // will be the same as that other schema. + // + // To have complete control of the model naming, one can define the model separately + // instead of inline. + String innerModelName = resolveModelName(component.getTitle(), key); + Schema innerModel = modelFromProperty(openAPI, component, innerModelName); + String existing = matchGenerated(innerModel); + if (existing == null) { + openAPI.getComponents().addSchemas(innerModelName, innerModel); + addGenerated(innerModelName, innerModel); + Schema schema = new Schema().$ref(innerModelName); + schema.setRequired(component.getRequired()); + listIterator.set(schema); + } else { + Schema schema = new Schema().$ref(existing); + schema.setRequired(component.getRequired()); + listIterator.set(schema); } - } else { - // likely a reference to schema (not inline schema) } } } @@ -540,7 +536,7 @@ public class InlineModelResolver { */ private String sanitizeName(final String name) { return name - .replaceAll("^[0-9]", "_") // e.g. 12object => _2object + .replaceAll("^[0-9]", "_$0") // e.g. 12object => _12object .replaceAll("[^A-Za-z0-9]", "_"); // e.g. io.schema.User name => io_schema_User_name } @@ -671,6 +667,8 @@ public class InlineModelResolver { model.setXml(xml); model.setRequired(object.getRequired()); model.setNullable(object.getNullable()); + model.setEnum(object.getEnum()); + model.setType(object.getType()); model.setDiscriminator(object.getDiscriminator()); model.setWriteOnly(object.getWriteOnly()); model.setUniqueItems(object.getUniqueItems()); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java index 81b33ca2e94..2080fca66a7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java @@ -22,6 +22,7 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.media.ArraySchema; +import io.swagger.v3.oas.models.media.ComposedSchema; import io.swagger.v3.oas.models.media.FileSchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.XML; @@ -96,14 +97,11 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { SecurityFeature.OAuth2_Implicit )) .excludeGlobalFeatures( - GlobalFeature.XMLStructureDefinitions, GlobalFeature.LinkObjects, GlobalFeature.ParameterStyling ) .excludeSchemaSupportFeatures( - SchemaSupportFeature.Polymorphism, - SchemaSupportFeature.Union, - SchemaSupportFeature.Composite + SchemaSupportFeature.Polymorphism ) .excludeParameterFeatures( ParameterFeature.Cookie @@ -400,7 +398,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { } // model name starts with number - else if (name.matches("^\\d.*")) { + else if (camelizedName.matches("^\\d.*")) { // e.g. 200Response => Model200Response (after camelize) camelizedName = "Model" + camelizedName; LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelizedName); @@ -1191,8 +1189,11 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { @Override public CodegenModel fromModel(String name, Schema model) { + LOGGER.trace("Creating model from schema: {}", model); + Map allDefinitions = ModelUtils.getSchemas(this.openAPI); CodegenModel mdl = super.fromModel(name, model); + mdl.vendorExtensions.put("x-upper-case-name", name.toUpperCase(Locale.ROOT)); if (!StringUtils.isEmpty(model.get$ref())) { Schema schema = allDefinitions.get(ModelUtils.getSimpleRef(model.get$ref())); @@ -1233,6 +1234,8 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { } else { mdl.arrayModelType = toModelName(mdl.arrayModelType); } + } else if ((mdl.anyOf.size() > 0) || (mdl.oneOf.size() > 0)) { + mdl.dataType = getSchemaType(model); } if (mdl.xmlNamespace != null) { @@ -1245,6 +1248,8 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { mdl.additionalPropertiesType = getTypeDeclaration(additionalProperties); } + LOGGER.trace("Created model: {}", mdl); + return mdl; } @@ -1403,6 +1408,28 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { return defaultValue; } + @Override + public String toOneOfName(List names, ComposedSchema composedSchema) { + List schemas = ModelUtils.getInterfaces(composedSchema); + + List types = new ArrayList<>(); + for (Schema s : schemas) { + types.add(getTypeDeclaration(s)); + } + return "swagger::OneOf" + types.size() + "<" + String.join(",", types) + ">"; + } + + @Override + public String toAnyOfName(List names, ComposedSchema composedSchema) { + List schemas = ModelUtils.getInterfaces(composedSchema); + + List types = new ArrayList<>(); + for (Schema s : schemas) { + types.add(getTypeDeclaration(s)); + } + return "swagger::AnyOf" + types.size() + "<" + String.join(",", types) + ">"; + } + @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { super.postProcessModelProperty(model, property); @@ -1529,6 +1556,8 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { Map mo = (Map) _mo; CodegenModel cm = (CodegenModel) mo.get("model"); + LOGGER.trace("Post processing model: {}", cm); + if (cm.dataType != null && cm.dataType.equals("object")) { // Object isn't a sensible default. Instead, we set it to // 'null'. This ensures that we treat this model as a struct diff --git a/modules/openapi-generator/src/main/resources/rust-server/models.mustache b/modules/openapi-generator/src/main/resources/rust-server/models.mustache index 6b4f9ffbb84..746e5dbd6cd 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/models.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/models.mustache @@ -4,10 +4,14 @@ use crate::models; #[cfg(any(feature = "client", feature = "server"))] use crate::header; {{! Don't "use" structs here - they can conflict with the names of models, and mean that the code won't compile }} +{{#models}} +{{#model}} -{{#models}}{{#model}} -{{#description}}/// {{{description}}} -{{/description}}{{#isEnum}}/// Enumeration of values. +{{#description}} +/// {{{description}}} +{{/description}} +{{#isEnum}} +/// Enumeration of values. /// Since this enum's variants do not hold data, we can easily define them them as `#[repr(C)]` /// which helps with FFI. #[allow(non_camel_case_types)] @@ -15,15 +19,23 @@ use crate::header; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk_enum_derive::LabelledGenericEnum))]{{#xmlName}} #[serde(rename = "{{{xmlName}}}")]{{/xmlName}} -pub enum {{{classname}}} { {{#allowableValues}}{{#enumVars}} +pub enum {{{classname}}} { +{{#allowableValues}} + {{#enumVars}} #[serde(rename = {{{value}}})] - {{{name}}},{{/enumVars}}{{/allowableValues}} + {{{name}}}, + {{/enumVars}} +{{/allowableValues}} } impl std::fmt::Display for {{{classname}}} { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match *self { {{#allowableValues}}{{#enumVars}} - {{{classname}}}::{{{name}}} => write!(f, "{}", {{{value}}}),{{/enumVars}}{{/allowableValues}} + match *self { +{{#allowableValues}} + {{#enumVars}} + {{{classname}}}::{{{name}}} => write!(f, "{}", {{{value}}}), + {{/enumVars}} +{{/allowableValues}} } } } @@ -62,8 +74,8 @@ impl std::convert::From<{{{dataType}}}> for {{{classname}}} { {{{classname}}}(x) } } - {{#vendorExtensions.x-is-string}} + impl std::string::ToString for {{{classname}}} { fn to_string(&self) -> String { self.0.to_string() @@ -121,45 +133,8 @@ impl ::std::str::FromStr for {{{classname}}} { {{/additionalPropertiesType}} {{/dataType}} {{^dataType}} -// Methods for converting between header::IntoHeaderValue<{{{classname}}}> and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue<{{{classname}}}>) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for {{classname}} - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue<{{{classname}}}> { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match <{{{classname}}} as std::str::FromStr>::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into {{classname}} - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - -{{#arrayModelType}}{{#vendorExtensions}}{{#x-item-xml-name}}// Utility function for wrapping list elements when serializing xml +{{#arrayModelType}} +{{#vendorExtensions}}{{#x-item-xml-name}}// Utility function for wrapping list elements when serializing xml #[allow(non_snake_case)] fn wrap_in_{{{x-item-xml-name}}}(item: &Vec<{{{arrayModelType}}}>, serializer: S) -> std::result::Result where @@ -265,7 +240,9 @@ impl std::str::FromStr for {{{classname}}} { } } -{{/arrayModelType}}{{^arrayModelType}}{{! general struct}} +{{/arrayModelType}} +{{^arrayModelType}} +{{! general struct}} #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] {{#xmlName}} @@ -417,7 +394,7 @@ impl std::str::FromStr for {{{classname}}} { "{{{baseName}}}" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in {{{classname}}}".to_string()), {{/isNullable}} {{^isNullable}} - "{{{baseName}}}" => intermediate_rep.{{{name}}}.push({{{dataType}}}::from_str(val).map_err(|x| format!("{}", x))?), + "{{{baseName}}}" => intermediate_rep.{{{name}}}.push(<{{{dataType}}} as std::str::FromStr>::from_str(val).map_err(|x| format!("{}", x))?), {{/isNullable}} {{/isContainer}} {{/isByteArray}} @@ -444,22 +421,60 @@ impl std::str::FromStr for {{{classname}}} { }) } } - {{/arrayModelType}} + +// Methods for converting between header::IntoHeaderValue<{{{classname}}}> and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<{{{classname}}}>) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for {{classname}} - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue<{{{classname}}}> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <{{{classname}}} as std::str::FromStr>::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into {{classname}} - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + {{/dataType}} {{/isEnum}} - {{#usesXml}} {{#usesXmlNamespaces}} {{#xmlNamespace}} + impl {{{classname}}} { /// Associated constant for this model's XML namespace. #[allow(dead_code)] pub const NAMESPACE: &'static str = "{{{xmlNamespace}}}"; } - {{/xmlNamespace}} {{/usesXmlNamespaces}} + impl {{{classname}}} { /// Helper function to allow us to convert this model to an XML string. /// Will panic if serialisation fails. @@ -478,4 +493,4 @@ impl {{{classname}}} { } {{/usesXml}} {{/model}} -{{/models}} \ No newline at end of file +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/rust-server/response.mustache b/modules/openapi-generator/src/main/resources/rust-server/response.mustache index 9269eea6386..39ff2782165 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/response.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/response.mustache @@ -42,7 +42,7 @@ pub enum {{{operationId}}}Response { {{^required}} Option< {{/required}} - {{{datatype}}} + {{{dataType}}} {{^required}} > {{/required}} diff --git a/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml b/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml index f059f8dba91..0bcea44a508 100644 --- a/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml @@ -357,7 +357,6 @@ paths: responses: '200': description: Success - /repos/{repoId}: parameters: - in: path @@ -391,6 +390,51 @@ paths: responses: '200': description: Success + /one-of: + get: + responses: + '200': + description: Success + content: + application/json: + schema: + oneOf: + - type: integer + - type: array + items: + type: string + /any-of: + get: + parameters: + - name: any-of + in: query + description: list of any of objects + schema: + type: array + items: + $ref: '#/components/schemas/AnyOfObject' + minItems: 1 + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: "#/components/schemas/AnyOfObject" + '201': + description: AlternateSuccess + content: + application/json: + schema: + $ref: "#/components/schemas/12345AnyOfObject" + '202': + description: AnyOfSuccess + content: + application/json: + schema: + anyOf: + - $ref: "#/components/schemas/StringObject" + - $ref: "#/components/schemas/UuidObject" /json-complex-query-param: get: parameters: @@ -418,6 +462,34 @@ components: test.read: Allowed to read state. test.write: Allowed to change state. schemas: + AnyOfProperty: + description: Test containing an anyOf object + properties: + requiredAnyOf: + $ref: '#/components/schemas/AnyOfObject' + optionalAnyOf: + $ref: '#/components/schemas/12345AnyOfObject' + required: + - requiredAnyOf + AnyOfObject: + description: Test a model containing an anyOf + anyOf: + - type: string + enum: + - FOO + - BAR + - type: string + description: Alternate option + 12345AnyOfObject: + description: Test a model containing an anyOf that starts with a number + anyOf: + - type: string + enum: + - FOO + - BAR + - "*" + - type: string + description: Alternate option EnumWithStarObject: description: Test a model containing a special character in the enum type: string diff --git a/samples/client/petstore/java/feign/feign10x/api/openapi.yaml b/samples/client/petstore/java/feign/feign10x/api/openapi.yaml index a49359fd348..00cc0f2f4c2 100644 --- a/samples/client/petstore/java/feign/feign10x/api/openapi.yaml +++ b/samples/client/petstore/java/feign/feign10x/api/openapi.yaml @@ -2151,10 +2151,12 @@ components: properties: breed: type: string + type: object Cat_allOf: properties: declawed: type: boolean + type: object BigCat_allOf: properties: kind: @@ -2164,6 +2166,7 @@ components: - leopards - jaguars type: string + type: object securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/rust-server/output/multipart-v3/docs/MultipartRequest.md b/samples/server/petstore/rust-server/output/multipart-v3/docs/MultipartRequest.md deleted file mode 100644 index dc52f53832a..00000000000 --- a/samples/server/petstore/rust-server/output/multipart-v3/docs/MultipartRequest.md +++ /dev/null @@ -1,13 +0,0 @@ -# MultipartRequest - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**string_field** | **String** | | -**optional_string_field** | **String** | | [optional] [default to None] -**object_field** | [***models::MultipartRequestObjectField**](multipart_request_object_field.md) | | [optional] [default to None] -**binary_field** | [***swagger::ByteArray**](ByteArray.md) | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/models.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/models.rs index b86806bfeeb..d201b0407f2 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/models.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/models.rs @@ -4,46 +4,6 @@ use crate::models; #[cfg(any(feature = "client", feature = "server"))] use crate::header; - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for InlineObject - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into InlineObject - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct InlineObject { @@ -128,36 +88,34 @@ impl std::str::FromStr for InlineObject { } } - - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for MultipartRelatedRequest - value: {} is invalid {}", + format!("Invalid header value for InlineObject - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into MultipartRelatedRequest - {}", + format!("Unable to convert header value '{}' into InlineObject - {}", value, err)) } }, @@ -242,7 +200,7 @@ impl std::str::FromStr for MultipartRelatedRequest { if let Some(key) = key_result { match key { - "object_field" => intermediate_rep.object_field.push(models::MultipartRequestObjectField::from_str(val).map_err(|x| format!("{}", x))?), + "object_field" => intermediate_rep.object_field.push(::from_str(val).map_err(|x| format!("{}", x))?), "optional_binary_field" => return std::result::Result::Err("Parsing binary data in this style is not supported in MultipartRelatedRequest".to_string()), "required_binary_field" => return std::result::Result::Err("Parsing binary data in this style is not supported in MultipartRelatedRequest".to_string()), _ => return std::result::Result::Err("Unexpected key while parsing MultipartRelatedRequest".to_string()) @@ -262,36 +220,34 @@ impl std::str::FromStr for MultipartRelatedRequest { } } - - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for MultipartRequestObjectField - value: {} is invalid {}", + format!("Invalid header value for MultipartRelatedRequest - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into MultipartRequestObjectField - {}", + format!("Unable to convert header value '{}' into MultipartRelatedRequest - {}", value, err)) } }, @@ -372,7 +328,7 @@ impl std::str::FromStr for MultipartRequestObjectField { if let Some(key) = key_result { match key { - "field_a" => intermediate_rep.field_a.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "field_a" => intermediate_rep.field_a.push(::from_str(val).map_err(|x| format!("{}", x))?), "field_b" => return std::result::Result::Err("Parsing a container in this style is not supported in MultipartRequestObjectField".to_string()), _ => return std::result::Result::Err("Unexpected key while parsing MultipartRequestObjectField".to_string()) } @@ -390,4 +346,41 @@ impl std::str::FromStr for MultipartRequestObjectField { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for MultipartRequestObjectField - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into MultipartRequestObjectField - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs index 7caa4ed9c1e..0175af64b56 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs @@ -4,46 +4,6 @@ use crate::models; #[cfg(any(feature = "client", feature = "server"))] use crate::header; - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for InlineObject - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into InlineObject - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct InlineObject { @@ -104,7 +64,7 @@ impl std::str::FromStr for InlineObject { if let Some(key) = key_result { match key { - "propery" => intermediate_rep.propery.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "propery" => intermediate_rep.propery.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing InlineObject".to_string()) } } @@ -120,4 +80,41 @@ impl std::str::FromStr for InlineObject { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for InlineObject - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into InlineObject - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} diff --git a/samples/server/petstore/rust-server/output/openapi-v3/.openapi-generator/FILES b/samples/server/petstore/rust-server/output/openapi-v3/.openapi-generator/FILES index 5f3122fbc3d..d1eaac072b4 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/.openapi-generator/FILES +++ b/samples/server/petstore/rust-server/output/openapi-v3/.openapi-generator/FILES @@ -7,11 +7,16 @@ docs/AdditionalPropertiesWithList.md docs/AnotherXmlArray.md docs/AnotherXmlInner.md docs/AnotherXmlObject.md +docs/AnyOfObject.md +docs/AnyOfObjectAnyOf.md +docs/AnyOfProperty.md docs/DuplicateXmlObject.md docs/EnumWithStarObject.md docs/Err.md docs/Error.md docs/InlineResponse201.md +docs/Model12345AnyOfObject.md +docs/Model12345AnyOfObjectAnyOf.md docs/MyId.md docs/MyIdList.md docs/NullableTest.md diff --git a/samples/server/petstore/rust-server/output/openapi-v3/README.md b/samples/server/petstore/rust-server/output/openapi-v3/README.md index b0fc2ee15f1..d0e29d93bf4 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/README.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/README.md @@ -61,6 +61,7 @@ cargo run --example server To run a client, follow one of the following simple steps: ``` +cargo run --example client AnyOfGet cargo run --example client CallbackWithHeaderPost cargo run --example client ComplexQueryParamGet cargo run --example client JsonComplexQueryParamGet @@ -68,6 +69,7 @@ cargo run --example client MandatoryRequestHeaderGet cargo run --example client MergePatchJsonGet cargo run --example client MultigetGet cargo run --example client MultipleAuthSchemeGet +cargo run --example client OneOfGet cargo run --example client OverrideServerGet cargo run --example client ParamgetGet cargo run --example client ReadonlyAuthSchemeGet @@ -117,6 +119,7 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- +[****](docs/default_api.md#) | **GET** /any-of | [****](docs/default_api.md#) | **POST** /callback-with-header | [****](docs/default_api.md#) | **GET** /complex-query-param | [****](docs/default_api.md#) | **GET** /enum_in_path/{path_param} | @@ -125,6 +128,7 @@ Method | HTTP request | Description [****](docs/default_api.md#) | **GET** /merge-patch-json | [****](docs/default_api.md#) | **GET** /multiget | Get some stuff. [****](docs/default_api.md#) | **GET** /multiple_auth_scheme | +[****](docs/default_api.md#) | **GET** /one-of | [****](docs/default_api.md#) | **GET** /override-server | [****](docs/default_api.md#) | **GET** /paramget | Get some stuff with parameters. [****](docs/default_api.md#) | **GET** /readonly_auth_scheme | @@ -149,11 +153,16 @@ Method | HTTP request | Description - [AnotherXmlArray](docs/AnotherXmlArray.md) - [AnotherXmlInner](docs/AnotherXmlInner.md) - [AnotherXmlObject](docs/AnotherXmlObject.md) + - [AnyOfObject](docs/AnyOfObject.md) + - [AnyOfObjectAnyOf](docs/AnyOfObjectAnyOf.md) + - [AnyOfProperty](docs/AnyOfProperty.md) - [DuplicateXmlObject](docs/DuplicateXmlObject.md) - [EnumWithStarObject](docs/EnumWithStarObject.md) - [Err](docs/Err.md) - [Error](docs/Error.md) - [InlineResponse201](docs/InlineResponse201.md) + - [Model12345AnyOfObject](docs/Model12345AnyOfObject.md) + - [Model12345AnyOfObjectAnyOf](docs/Model12345AnyOfObjectAnyOf.md) - [MyId](docs/MyId.md) - [MyIdList](docs/MyIdList.md) - [NullableTest](docs/NullableTest.md) diff --git a/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml b/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml index 984374b520a..fab686f0ebf 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml +++ b/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml @@ -407,6 +407,54 @@ paths: description: Success tags: - Repo + /one-of: + get: + responses: + "200": + content: + application/json: + schema: + oneOf: + - type: integer + - items: + type: string + type: array + description: Success + /any-of: + get: + parameters: + - description: list of any of objects + explode: true + in: query + name: any-of + required: false + schema: + items: + $ref: '#/components/schemas/AnyOfObject' + minItems: 1 + type: array + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AnyOfObject' + description: Success + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/12345AnyOfObject' + description: AlternateSuccess + "202": + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/StringObject' + - $ref: '#/components/schemas/UuidObject' + description: AnyOfSuccess /json-complex-query-param: get: parameters: @@ -426,6 +474,27 @@ paths: description: Success components: schemas: + AnyOfProperty: + description: Test containing an anyOf object + properties: + requiredAnyOf: + $ref: '#/components/schemas/AnyOfObject' + optionalAnyOf: + $ref: '#/components/schemas/12345AnyOfObject' + required: + - requiredAnyOf + AnyOfObject: + anyOf: + - $ref: '#/components/schemas/AnyOfObject_anyOf' + - description: Alternate option + type: string + description: Test a model containing an anyOf + "12345AnyOfObject": + anyOf: + - $ref: '#/components/schemas/_12345AnyOfObject_anyOf' + - description: Alternate option + type: string + description: Test a model containing an anyOf that starts with a number EnumWithStarObject: description: Test a model containing a special character in the enum enum: @@ -607,6 +676,17 @@ components: foo: type: string type: object + AnyOfObject_anyOf: + enum: + - FOO + - BAR + type: string + _12345AnyOfObject_anyOf: + enum: + - FOO + - BAR + - '*' + type: string securitySchemes: authScheme: flows: diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfObject.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfObject.md new file mode 100644 index 00000000000..36847cbf694 --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfObject.md @@ -0,0 +1,9 @@ +# AnyOfObject + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfObjectAnyOf.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfObjectAnyOf.md new file mode 100644 index 00000000000..079256f1726 --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfObjectAnyOf.md @@ -0,0 +1,9 @@ +# AnyOfObjectAnyOf + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfProperty.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfProperty.md new file mode 100644 index 00000000000..c4e69ef4caf --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfProperty.md @@ -0,0 +1,11 @@ +# AnyOfProperty + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**required_any_of** | [***models::AnyOfObject**](AnyOfObject.md) | | +**optional_any_of** | [***models::Model12345AnyOfObject**](12345AnyOfObject.md) | | [optional] [default to None] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/Model12345AnyOfObject.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/Model12345AnyOfObject.md new file mode 100644 index 00000000000..8999550d65e --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/Model12345AnyOfObject.md @@ -0,0 +1,9 @@ +# Model12345AnyOfObject + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/Model12345AnyOfObjectAnyOf.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/Model12345AnyOfObjectAnyOf.md new file mode 100644 index 00000000000..096f40837fa --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/Model12345AnyOfObjectAnyOf.md @@ -0,0 +1,9 @@ +# Model12345AnyOfObjectAnyOf + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md index 42aa82f35d7..1358c8fb1b8 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md @@ -4,6 +4,7 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- +****](default_api.md#) | **GET** /any-of | ****](default_api.md#) | **POST** /callback-with-header | ****](default_api.md#) | **GET** /complex-query-param | ****](default_api.md#) | **GET** /enum_in_path/{path_param} | @@ -12,6 +13,7 @@ Method | HTTP request | Description ****](default_api.md#) | **GET** /merge-patch-json | ****](default_api.md#) | **GET** /multiget | Get some stuff. ****](default_api.md#) | **GET** /multiple_auth_scheme | +****](default_api.md#) | **GET** /one-of | ****](default_api.md#) | **GET** /override-server | ****](default_api.md#) | **GET** /paramget | Get some stuff with parameters. ****](default_api.md#) | **GET** /readonly_auth_scheme | @@ -28,6 +30,38 @@ Method | HTTP request | Description ****](default_api.md#) | **PUT** /xml | +# **** +> models::AnyOfObject (optional) + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **any_of** | [**models::AnyOfObject**](models::AnyOfObject.md)| list of any of objects | + +### Return type + +[**models::AnyOfObject**](AnyOfObject.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **** > (url) @@ -233,6 +267,28 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **** +> swagger::OneOf2> () + + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**swagger::OneOf2>**](swagger::OneOf2>.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **** > () diff --git a/samples/server/petstore/rust-server/output/openapi-v3/examples/client/main.rs b/samples/server/petstore/rust-server/output/openapi-v3/examples/client/main.rs index 700e2ff2235..04b4e28dfde 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/examples/client/main.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/examples/client/main.rs @@ -6,6 +6,7 @@ mod server; use futures::{future, Stream, stream}; #[allow(unused_imports)] use openapi_v3::{Api, ApiNoContext, Client, ContextWrapperExt, models, + AnyOfGetResponse, CallbackWithHeaderPostResponse, ComplexQueryParamGetResponse, EnumInPathPathParamGetResponse, @@ -14,6 +15,7 @@ use openapi_v3::{Api, ApiNoContext, Client, ContextWrapperExt, models, MergePatchJsonGetResponse, MultigetGetResponse, MultipleAuthSchemeGetResponse, + OneOfGetResponse, OverrideServerGetResponse, ParamgetGetResponse, ReadonlyAuthSchemeGetResponse, @@ -51,6 +53,7 @@ fn main() { .arg(Arg::with_name("operation") .help("Sets the operation to run") .possible_values(&[ + "AnyOfGet", "CallbackWithHeaderPost", "ComplexQueryParamGet", "JsonComplexQueryParamGet", @@ -58,6 +61,7 @@ fn main() { "MergePatchJsonGet", "MultigetGet", "MultipleAuthSchemeGet", + "OneOfGet", "OverrideServerGet", "ParamgetGet", "ReadonlyAuthSchemeGet", @@ -120,6 +124,12 @@ fn main() { rt.spawn(server::create("127.0.0.1:8081", false)); match matches.value_of("operation") { + Some("AnyOfGet") => { + let result = rt.block_on(client.any_of_get( + Some(&Vec::new()) + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); + }, Some("CallbackWithHeaderPost") => { let result = rt.block_on(client.callback_with_header_post( "url_example".to_string() @@ -167,6 +177,11 @@ fn main() { )); info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, + Some("OneOfGet") => { + let result = rt.block_on(client.one_of_get( + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); + }, Some("OverrideServerGet") => { let result = rt.block_on(client.override_server_get( )); diff --git a/samples/server/petstore/rust-server/output/openapi-v3/examples/server/server.rs b/samples/server/petstore/rust-server/output/openapi-v3/examples/server/server.rs index b5535b3ebd5..a40212742c5 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/examples/server/server.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/examples/server/server.rs @@ -96,6 +96,7 @@ impl Server { use openapi_v3::{ Api, + AnyOfGetResponse, CallbackWithHeaderPostResponse, ComplexQueryParamGetResponse, EnumInPathPathParamGetResponse, @@ -104,6 +105,7 @@ use openapi_v3::{ MergePatchJsonGetResponse, MultigetGetResponse, MultipleAuthSchemeGetResponse, + OneOfGetResponse, OverrideServerGetResponse, ParamgetGetResponse, ReadonlyAuthSchemeGetResponse, @@ -128,6 +130,16 @@ use swagger::ApiError; #[async_trait] impl Api for Server where C: Has + Send + Sync { + async fn any_of_get( + &self, + any_of: Option<&Vec>, + context: &C) -> Result + { + let context = context.clone(); + info!("any_of_get({:?}) - X-Span-ID: {:?}", any_of, context.get().0.clone()); + Err("Generic failuare".into()) + } + async fn callback_with_header_post( &self, url: String, @@ -206,6 +218,15 @@ impl Api for Server where C: Has + Send + Sync Err("Generic failuare".into()) } + async fn one_of_get( + &self, + context: &C) -> Result + { + let context = context.clone(); + info!("one_of_get() - X-Span-ID: {:?}", context.get().0.clone()); + Err("Generic failuare".into()) + } + async fn override_server_get( &self, context: &C) -> Result diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs index 3817bd07555..396d05a98cb 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs @@ -36,6 +36,7 @@ const FRAGMENT_ENCODE_SET: &AsciiSet = &percent_encoding::CONTROLS const ID_ENCODE_SET: &AsciiSet = &FRAGMENT_ENCODE_SET.add(b'|'); use crate::{Api, + AnyOfGetResponse, CallbackWithHeaderPostResponse, ComplexQueryParamGetResponse, EnumInPathPathParamGetResponse, @@ -44,6 +45,7 @@ use crate::{Api, MergePatchJsonGetResponse, MultigetGetResponse, MultipleAuthSchemeGetResponse, + OneOfGetResponse, OverrideServerGetResponse, ParamgetGetResponse, ReadonlyAuthSchemeGetResponse, @@ -405,6 +407,110 @@ impl Api for Client where } } + async fn any_of_get( + &self, + param_any_of: Option<&Vec>, + context: &C) -> Result + { + let mut client_service = self.client_service.clone(); + let mut uri = format!( + "{}/any-of", + self.base_path + ); + + // Query parameters + let query_string = { + let mut query_string = form_urlencoded::Serializer::new("".to_owned()); + if let Some(param_any_of) = param_any_of { + query_string.append_pair("any-of", + ¶m_any_of.iter().map(ToString::to_string).collect::>().join(",")); + } + query_string.finish() + }; + if !query_string.is_empty() { + uri += "?"; + uri += &query_string; + } + + let uri = match Uri::from_str(&uri) { + Ok(uri) => uri, + Err(err) => return Err(ApiError(format!("Unable to build URI: {}", err))), + }; + + let mut request = match Request::builder() + .method("GET") + .uri(uri) + .body(Body::empty()) { + Ok(req) => req, + Err(e) => return Err(ApiError(format!("Unable to create request: {}", e))) + }; + + let header = HeaderValue::from_str(Has::::get(context).0.clone().to_string().as_str()); + request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { + Ok(h) => h, + Err(e) => return Err(ApiError(format!("Unable to create X-Span ID header value: {}", e))) + }); + + let mut response = client_service.call((request, context.clone())) + .map_err(|e| ApiError(format!("No response received: {}", e))).await?; + + match response.status().as_u16() { + 200 => { + let body = response.into_body(); + let body = body + .to_raw() + .map_err(|e| ApiError(format!("Failed to read response: {}", e))).await?; + let body = str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(body)?; + Ok(AnyOfGetResponse::Success + (body) + ) + } + 201 => { + let body = response.into_body(); + let body = body + .to_raw() + .map_err(|e| ApiError(format!("Failed to read response: {}", e))).await?; + let body = str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(body)?; + Ok(AnyOfGetResponse::AlternateSuccess + (body) + ) + } + 202 => { + let body = response.into_body(); + let body = body + .to_raw() + .map_err(|e| ApiError(format!("Failed to read response: {}", e))).await?; + let body = str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::>(body)?; + Ok(AnyOfGetResponse::AnyOfSuccess + (body) + ) + } + code => { + let headers = response.headers().clone(); + let body = response.into_body() + .take(100) + .to_raw().await; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", + code, + headers, + match body { + Ok(body) => match String::from_utf8(body) { + Ok(body) => body, + Err(e) => format!("", e), + }, + Err(e) => format!("", e), + } + ))) + } + } + } + async fn callback_with_header_post( &self, param_url: String, @@ -1089,6 +1195,81 @@ impl Api for Client where } } + async fn one_of_get( + &self, + context: &C) -> Result + { + let mut client_service = self.client_service.clone(); + let mut uri = format!( + "{}/one-of", + self.base_path + ); + + // Query parameters + let query_string = { + let mut query_string = form_urlencoded::Serializer::new("".to_owned()); + query_string.finish() + }; + if !query_string.is_empty() { + uri += "?"; + uri += &query_string; + } + + let uri = match Uri::from_str(&uri) { + Ok(uri) => uri, + Err(err) => return Err(ApiError(format!("Unable to build URI: {}", err))), + }; + + let mut request = match Request::builder() + .method("GET") + .uri(uri) + .body(Body::empty()) { + Ok(req) => req, + Err(e) => return Err(ApiError(format!("Unable to create request: {}", e))) + }; + + let header = HeaderValue::from_str(Has::::get(context).0.clone().to_string().as_str()); + request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { + Ok(h) => h, + Err(e) => return Err(ApiError(format!("Unable to create X-Span ID header value: {}", e))) + }); + + let mut response = client_service.call((request, context.clone())) + .map_err(|e| ApiError(format!("No response received: {}", e))).await?; + + match response.status().as_u16() { + 200 => { + let body = response.into_body(); + let body = body + .to_raw() + .map_err(|e| ApiError(format!("Failed to read response: {}", e))).await?; + let body = str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::>>(body)?; + Ok(OneOfGetResponse::Success + (body) + ) + } + code => { + let headers = response.headers().clone(); + let body = response.into_body() + .take(100) + .to_raw().await; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", + code, + headers, + match body { + Ok(body) => match String::from_utf8(body) { + Ok(body) => body, + Err(e) => format!("", e), + }, + Err(e) => format!("", e), + } + ))) + } + } + } + async fn override_server_get( &self, context: &C) -> Result diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs index 6a269c49f2a..458aa65a99a 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs @@ -11,6 +11,22 @@ type ServiceError = Box; pub const BASE_PATH: &'static str = ""; pub const API_VERSION: &'static str = "1.0.7"; +#[derive(Debug, PartialEq)] +#[must_use] +pub enum AnyOfGetResponse { + /// Success + Success + (models::AnyOfObject) + , + /// AlternateSuccess + AlternateSuccess + (models::Model12345AnyOfObject) + , + /// AnyOfSuccess + AnyOfSuccess + (swagger::AnyOf2) +} + #[derive(Debug, PartialEq)] pub enum CallbackWithHeaderPostResponse { /// OK @@ -86,6 +102,13 @@ pub enum MultipleAuthSchemeGetResponse { CheckThatLimitingToMultipleRequiredAuthSchemesWorks } +#[derive(Debug, PartialEq)] +pub enum OneOfGetResponse { + /// Success + Success + (swagger::OneOf2>) +} + #[derive(Debug, PartialEq)] pub enum OverrideServerGetResponse { /// Success. @@ -253,6 +276,11 @@ pub trait Api { Poll::Ready(Ok(())) } + async fn any_of_get( + &self, + any_of: Option<&Vec>, + context: &C) -> Result; + async fn callback_with_header_post( &self, url: String, @@ -291,6 +319,10 @@ pub trait Api { &self, context: &C) -> Result; + async fn one_of_get( + &self, + context: &C) -> Result; + async fn override_server_get( &self, context: &C) -> Result; @@ -380,6 +412,11 @@ pub trait ApiNoContext { fn context(&self) -> &C; + async fn any_of_get( + &self, + any_of: Option<&Vec>, + ) -> Result; + async fn callback_with_header_post( &self, url: String, @@ -418,6 +455,10 @@ pub trait ApiNoContext { &self, ) -> Result; + async fn one_of_get( + &self, + ) -> Result; + async fn override_server_get( &self, ) -> Result; @@ -522,6 +563,15 @@ impl + Send + Sync, C: Clone + Send + Sync> ApiNoContext for Contex ContextWrapper::context(self) } + async fn any_of_get( + &self, + any_of: Option<&Vec>, + ) -> Result + { + let context = self.context().clone(); + self.api().any_of_get(any_of, &context).await + } + async fn callback_with_header_post( &self, url: String, @@ -592,6 +642,14 @@ impl + Send + Sync, C: Clone + Send + Sync> ApiNoContext for Contex self.api().multiple_auth_scheme_get(&context).await } + async fn one_of_get( + &self, + ) -> Result + { + let context = self.context().clone(); + self.api().one_of_get(&context).await + } + async fn override_server_get( &self, ) -> Result diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs index 729d1279e63..68647720d26 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs @@ -4,7 +4,6 @@ use crate::models; #[cfg(any(feature = "client", feature = "server"))] use crate::header; - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct AdditionalPropertiesWithList(std::collections::HashMap>); @@ -15,7 +14,6 @@ impl std::convert::From>> for Addi } } - impl std::convert::From for std::collections::HashMap> { fn from(x: AdditionalPropertiesWithList) -> Self { x.0 @@ -65,44 +63,6 @@ impl AdditionalPropertiesWithList { } } -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for AnotherXmlArray - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into AnotherXmlArray - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - // Utility function for wrapping list elements when serializing xml #[allow(non_snake_case)] fn wrap_in_snake_another_xml_inner(item: &Vec, serializer: S) -> std::result::Result @@ -203,6 +163,45 @@ impl std::str::FromStr for AnotherXmlArray { } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for AnotherXmlArray - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into AnotherXmlArray - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + + impl AnotherXmlArray { /// Helper function to allow us to convert this model to an XML string. /// Will panic if serialisation fails. @@ -266,45 +265,6 @@ impl AnotherXmlInner { } /// An XML object -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for AnotherXmlObject - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into AnotherXmlObject - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "snake_another_xml_object")] @@ -366,7 +326,7 @@ impl std::str::FromStr for AnotherXmlObject { if let Some(key) = key_result { match key { - "inner_string" => intermediate_rep.inner_string.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "inner_string" => intermediate_rep.inner_string.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing AnotherXmlObject".to_string()) } } @@ -382,6 +342,44 @@ impl std::str::FromStr for AnotherXmlObject { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for AnotherXmlObject - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into AnotherXmlObject - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + impl AnotherXmlObject { /// Associated constant for this model's XML namespace. @@ -401,35 +399,97 @@ impl AnotherXmlObject { } } -/// An XML object -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +/// Test a model containing an anyOf +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct AnyOfObject { +} + +impl AnyOfObject { + pub fn new() -> AnyOfObject { + AnyOfObject { + } + } +} + +/// Converts the AnyOfObject value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::string::ToString for AnyOfObject { + fn to_string(&self) -> String { + let mut params: Vec = vec![]; + params.join(",").to_string() + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a AnyOfObject value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for AnyOfObject { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + #[derive(Default)] + // An intermediate representation of the struct to use for parsing. + struct IntermediateRep { + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(',').into_iter(); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => return std::result::Result::Err("Missing value while parsing AnyOfObject".to_string()) + }; + + if let Some(key) = key_result { + match key { + _ => return std::result::Result::Err("Unexpected key while parsing AnyOfObject".to_string()) + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(AnyOfObject { + }) + } +} + +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for DuplicateXmlObject - value: {} is invalid {}", + format!("Invalid header value for AnyOfObject - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into DuplicateXmlObject - {}", + format!("Unable to convert header value '{}' into AnyOfObject - {}", value, err)) } }, @@ -441,6 +501,190 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl AnyOfObject { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + +/// Enumeration of values. +/// Since this enum's variants do not hold data, we can easily define them them as `#[repr(C)]` +/// which helps with FFI. +#[allow(non_camel_case_types)] +#[repr(C)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk_enum_derive::LabelledGenericEnum))] +pub enum AnyOfObjectAnyOf { + #[serde(rename = "FOO")] + FOO, + #[serde(rename = "BAR")] + BAR, +} + +impl std::fmt::Display for AnyOfObjectAnyOf { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match *self { + AnyOfObjectAnyOf::FOO => write!(f, "{}", "FOO"), + AnyOfObjectAnyOf::BAR => write!(f, "{}", "BAR"), + } + } +} + +impl std::str::FromStr for AnyOfObjectAnyOf { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + match s { + "FOO" => std::result::Result::Ok(AnyOfObjectAnyOf::FOO), + "BAR" => std::result::Result::Ok(AnyOfObjectAnyOf::BAR), + _ => std::result::Result::Err(format!("Value not valid: {}", s)), + } + } +} + +impl AnyOfObjectAnyOf { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + +/// Test containing an anyOf object +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct AnyOfProperty { + #[serde(rename = "requiredAnyOf")] + pub required_any_of: models::AnyOfObject, + + #[serde(rename = "optionalAnyOf")] + #[serde(skip_serializing_if="Option::is_none")] + pub optional_any_of: Option, + +} + +impl AnyOfProperty { + pub fn new(required_any_of: models::AnyOfObject, ) -> AnyOfProperty { + AnyOfProperty { + required_any_of: required_any_of, + optional_any_of: None, + } + } +} + +/// Converts the AnyOfProperty value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::string::ToString for AnyOfProperty { + fn to_string(&self) -> String { + let mut params: Vec = vec![]; + // Skipping requiredAnyOf in query parameter serialization + + // Skipping optionalAnyOf in query parameter serialization + + params.join(",").to_string() + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a AnyOfProperty value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for AnyOfProperty { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + #[derive(Default)] + // An intermediate representation of the struct to use for parsing. + struct IntermediateRep { + pub required_any_of: Vec, + pub optional_any_of: Vec, + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(',').into_iter(); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => return std::result::Result::Err("Missing value while parsing AnyOfProperty".to_string()) + }; + + if let Some(key) = key_result { + match key { + "requiredAnyOf" => intermediate_rep.required_any_of.push(::from_str(val).map_err(|x| format!("{}", x))?), + "optionalAnyOf" => intermediate_rep.optional_any_of.push(::from_str(val).map_err(|x| format!("{}", x))?), + _ => return std::result::Result::Err("Unexpected key while parsing AnyOfProperty".to_string()) + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(AnyOfProperty { + required_any_of: intermediate_rep.required_any_of.into_iter().next().ok_or("requiredAnyOf missing in AnyOfProperty".to_string())?, + optional_any_of: intermediate_rep.optional_any_of.into_iter().next(), + }) + } +} + +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for AnyOfProperty - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into AnyOfProperty - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + + +impl AnyOfProperty { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + +/// An XML object #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "camelDuplicateXmlObject")] @@ -510,8 +754,8 @@ impl std::str::FromStr for DuplicateXmlObject { if let Some(key) = key_result { match key { - "inner_string" => intermediate_rep.inner_string.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "inner_array" => intermediate_rep.inner_array.push(models::XmlArray::from_str(val).map_err(|x| format!("{}", x))?), + "inner_string" => intermediate_rep.inner_string.push(::from_str(val).map_err(|x| format!("{}", x))?), + "inner_array" => intermediate_rep.inner_array.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing DuplicateXmlObject".to_string()) } } @@ -528,6 +772,44 @@ impl std::str::FromStr for DuplicateXmlObject { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for DuplicateXmlObject - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into DuplicateXmlObject - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + impl DuplicateXmlObject { /// Associated constant for this model's XML namespace. @@ -555,7 +837,7 @@ impl DuplicateXmlObject { #[repr(C)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk_enum_derive::LabelledGenericEnum))] -pub enum EnumWithStarObject { +pub enum EnumWithStarObject { #[serde(rename = "FOO")] FOO, #[serde(rename = "BAR")] @@ -566,7 +848,7 @@ pub enum EnumWithStarObject { impl std::fmt::Display for EnumWithStarObject { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match *self { + match *self { EnumWithStarObject::FOO => write!(f, "{}", "FOO"), EnumWithStarObject::BAR => write!(f, "{}", "BAR"), EnumWithStarObject::STAR => write!(f, "{}", "*"), @@ -700,45 +982,6 @@ impl Error { } } -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for InlineResponse201 - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into InlineResponse201 - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct InlineResponse201 { @@ -799,7 +1042,7 @@ impl std::str::FromStr for InlineResponse201 { if let Some(key) = key_result { match key { - "foo" => intermediate_rep.foo.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "foo" => intermediate_rep.foo.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing InlineResponse201".to_string()) } } @@ -815,6 +1058,44 @@ impl std::str::FromStr for InlineResponse201 { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for InlineResponse201 - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into InlineResponse201 - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + impl InlineResponse201 { /// Helper function to allow us to convert this model to an XML string. @@ -825,6 +1106,165 @@ impl InlineResponse201 { } } +/// Test a model containing an anyOf that starts with a number +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct Model12345AnyOfObject { +} + +impl Model12345AnyOfObject { + pub fn new() -> Model12345AnyOfObject { + Model12345AnyOfObject { + } + } +} + +/// Converts the Model12345AnyOfObject value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::string::ToString for Model12345AnyOfObject { + fn to_string(&self) -> String { + let mut params: Vec = vec![]; + params.join(",").to_string() + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a Model12345AnyOfObject value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for Model12345AnyOfObject { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + #[derive(Default)] + // An intermediate representation of the struct to use for parsing. + struct IntermediateRep { + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(',').into_iter(); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => return std::result::Result::Err("Missing value while parsing Model12345AnyOfObject".to_string()) + }; + + if let Some(key) = key_result { + match key { + _ => return std::result::Result::Err("Unexpected key while parsing Model12345AnyOfObject".to_string()) + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(Model12345AnyOfObject { + }) + } +} + +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for Model12345AnyOfObject - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into Model12345AnyOfObject - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + + +impl Model12345AnyOfObject { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + +/// Enumeration of values. +/// Since this enum's variants do not hold data, we can easily define them them as `#[repr(C)]` +/// which helps with FFI. +#[allow(non_camel_case_types)] +#[repr(C)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk_enum_derive::LabelledGenericEnum))] +pub enum Model12345AnyOfObjectAnyOf { + #[serde(rename = "FOO")] + FOO, + #[serde(rename = "BAR")] + BAR, + #[serde(rename = "*")] + STAR, +} + +impl std::fmt::Display for Model12345AnyOfObjectAnyOf { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match *self { + Model12345AnyOfObjectAnyOf::FOO => write!(f, "{}", "FOO"), + Model12345AnyOfObjectAnyOf::BAR => write!(f, "{}", "BAR"), + Model12345AnyOfObjectAnyOf::STAR => write!(f, "{}", "*"), + } + } +} + +impl std::str::FromStr for Model12345AnyOfObjectAnyOf { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + match s { + "FOO" => std::result::Result::Ok(Model12345AnyOfObjectAnyOf::FOO), + "BAR" => std::result::Result::Ok(Model12345AnyOfObjectAnyOf::BAR), + "*" => std::result::Result::Ok(Model12345AnyOfObjectAnyOf::STAR), + _ => std::result::Result::Err(format!("Value not valid: {}", s)), + } + } +} + +impl Model12345AnyOfObjectAnyOf { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct MyId(i32); @@ -835,7 +1275,6 @@ impl std::convert::From for MyId { } } - impl std::convert::From for i32 { fn from(x: MyId) -> Self { x.0 @@ -865,44 +1304,6 @@ impl MyId { } } -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for MyIdList - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into MyIdList - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct MyIdList( @@ -993,43 +1394,34 @@ impl std::str::FromStr for MyIdList { } -impl MyIdList { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for NullableTest - value: {} is invalid {}", + format!("Invalid header value for MyIdList - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into NullableTest - {}", + format!("Unable to convert header value '{}' into MyIdList - {}", value, err)) } }, @@ -1041,6 +1433,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl MyIdList { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct NullableTest { @@ -1178,44 +1579,34 @@ impl std::str::FromStr for NullableTest { } } - -impl NullableTest { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ObjectHeader - value: {} is invalid {}", + format!("Invalid header value for NullableTest - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ObjectHeader - {}", + format!("Unable to convert header value '{}' into NullableTest - {}", value, err)) } }, @@ -1227,6 +1618,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl NullableTest { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ObjectHeader { @@ -1296,8 +1696,8 @@ impl std::str::FromStr for ObjectHeader { if let Some(key) = key_result { match key { - "requiredObjectHeader" => intermediate_rep.required_object_header.push(bool::from_str(val).map_err(|x| format!("{}", x))?), - "optionalObjectHeader" => intermediate_rep.optional_object_header.push(isize::from_str(val).map_err(|x| format!("{}", x))?), + "requiredObjectHeader" => intermediate_rep.required_object_header.push(::from_str(val).map_err(|x| format!("{}", x))?), + "optionalObjectHeader" => intermediate_rep.optional_object_header.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing ObjectHeader".to_string()) } } @@ -1314,44 +1714,34 @@ impl std::str::FromStr for ObjectHeader { } } - -impl ObjectHeader { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ObjectParam - value: {} is invalid {}", + format!("Invalid header value for ObjectHeader - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ObjectParam - {}", + format!("Unable to convert header value '{}' into ObjectHeader - {}", value, err)) } }, @@ -1363,6 +1753,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl ObjectHeader { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ObjectParam { @@ -1432,8 +1831,8 @@ impl std::str::FromStr for ObjectParam { if let Some(key) = key_result { match key { - "requiredParam" => intermediate_rep.required_param.push(bool::from_str(val).map_err(|x| format!("{}", x))?), - "optionalParam" => intermediate_rep.optional_param.push(isize::from_str(val).map_err(|x| format!("{}", x))?), + "requiredParam" => intermediate_rep.required_param.push(::from_str(val).map_err(|x| format!("{}", x))?), + "optionalParam" => intermediate_rep.optional_param.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing ObjectParam".to_string()) } } @@ -1450,44 +1849,34 @@ impl std::str::FromStr for ObjectParam { } } - -impl ObjectParam { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ObjectUntypedProps - value: {} is invalid {}", + format!("Invalid header value for ObjectParam - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ObjectUntypedProps - {}", + format!("Unable to convert header value '{}' into ObjectParam - {}", value, err)) } }, @@ -1499,6 +1888,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl ObjectParam { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ObjectUntypedProps { @@ -1577,10 +1975,10 @@ impl std::str::FromStr for ObjectUntypedProps { if let Some(key) = key_result { match key { - "required_untyped" => intermediate_rep.required_untyped.push(serde_json::Value::from_str(val).map_err(|x| format!("{}", x))?), + "required_untyped" => intermediate_rep.required_untyped.push(::from_str(val).map_err(|x| format!("{}", x))?), "required_untyped_nullable" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in ObjectUntypedProps".to_string()), - "not_required_untyped" => intermediate_rep.not_required_untyped.push(serde_json::Value::from_str(val).map_err(|x| format!("{}", x))?), - "not_required_untyped_nullable" => intermediate_rep.not_required_untyped_nullable.push(serde_json::Value::from_str(val).map_err(|x| format!("{}", x))?), + "not_required_untyped" => intermediate_rep.not_required_untyped.push(::from_str(val).map_err(|x| format!("{}", x))?), + "not_required_untyped_nullable" => intermediate_rep.not_required_untyped_nullable.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing ObjectUntypedProps".to_string()) } } @@ -1599,44 +1997,34 @@ impl std::str::FromStr for ObjectUntypedProps { } } - -impl ObjectUntypedProps { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ObjectWithArrayOfObjects - value: {} is invalid {}", + format!("Invalid header value for ObjectUntypedProps - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ObjectWithArrayOfObjects - {}", + format!("Unable to convert header value '{}' into ObjectUntypedProps - {}", value, err)) } }, @@ -1648,6 +2036,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl ObjectUntypedProps { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ObjectWithArrayOfObjects { @@ -1724,6 +2121,44 @@ impl std::str::FromStr for ObjectWithArrayOfObjects { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for ObjectWithArrayOfObjects - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into ObjectWithArrayOfObjects - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + impl ObjectWithArrayOfObjects { /// Helper function to allow us to convert this model to an XML string. @@ -1796,7 +2231,6 @@ impl std::convert::From for OptionalObjectHeader { } } - impl std::convert::From for i32 { fn from(x: OptionalObjectHeader) -> Self { x.0 @@ -1836,7 +2270,6 @@ impl std::convert::From for RequiredObjectHeader { } } - impl std::convert::From for bool { fn from(x: RequiredObjectHeader) -> Self { x.0 @@ -1925,7 +2358,7 @@ impl Result { #[repr(C)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk_enum_derive::LabelledGenericEnum))] -pub enum StringEnum { +pub enum StringEnum { #[serde(rename = "FOO")] FOO, #[serde(rename = "BAR")] @@ -1934,7 +2367,7 @@ pub enum StringEnum { impl std::fmt::Display for StringEnum { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match *self { + match *self { StringEnum::FOO => write!(f, "{}", "FOO"), StringEnum::BAR => write!(f, "{}", "BAR"), } @@ -2025,7 +2458,6 @@ impl std::convert::From for UuidObject { } } - impl std::convert::From for uuid::Uuid { fn from(x: UuidObject) -> Self { x.0 @@ -2055,44 +2487,6 @@ impl UuidObject { } } -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for XmlArray - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into XmlArray - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - // Utility function for wrapping list elements when serializing xml #[allow(non_snake_case)] fn wrap_in_camelXmlInner(item: &Vec, serializer: S) -> std::result::Result @@ -2193,6 +2587,45 @@ impl std::str::FromStr for XmlArray { } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for XmlArray - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into XmlArray - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + + impl XmlArray { /// Helper function to allow us to convert this model to an XML string. /// Will panic if serialisation fails. @@ -2256,45 +2689,6 @@ impl XmlInner { } /// An XML object -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for XmlObject - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into XmlObject - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "camelXmlObject")] @@ -2368,8 +2762,8 @@ impl std::str::FromStr for XmlObject { if let Some(key) = key_result { match key { - "innerString" => intermediate_rep.inner_string.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "other_inner_rename" => intermediate_rep.other_inner_rename.push(isize::from_str(val).map_err(|x| format!("{}", x))?), + "innerString" => intermediate_rep.inner_string.push(::from_str(val).map_err(|x| format!("{}", x))?), + "other_inner_rename" => intermediate_rep.other_inner_rename.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing XmlObject".to_string()) } } @@ -2386,6 +2780,44 @@ impl std::str::FromStr for XmlObject { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for XmlObject - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into XmlObject - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + impl XmlObject { /// Associated constant for this model's XML namespace. diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs index eb6ca983932..ec6863b8bd3 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs @@ -22,6 +22,7 @@ pub use crate::context; type ServiceFuture = BoxFuture<'static, Result, crate::ServiceError>>; use crate::{Api, + AnyOfGetResponse, CallbackWithHeaderPostResponse, ComplexQueryParamGetResponse, EnumInPathPathParamGetResponse, @@ -30,6 +31,7 @@ use crate::{Api, MergePatchJsonGetResponse, MultigetGetResponse, MultipleAuthSchemeGetResponse, + OneOfGetResponse, OverrideServerGetResponse, ParamgetGetResponse, ReadonlyAuthSchemeGetResponse, @@ -55,6 +57,7 @@ mod paths { lazy_static! { pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(vec![ + r"^/any-of$", r"^/callback-with-header$", r"^/complex-query-param$", r"^/enum_in_path/(?P[^/?#]*)$", @@ -63,6 +66,7 @@ mod paths { r"^/merge-patch-json$", r"^/multiget$", r"^/multiple_auth_scheme$", + r"^/one-of$", r"^/override-server$", r"^/paramget$", r"^/readonly_auth_scheme$", @@ -80,38 +84,40 @@ mod paths { ]) .expect("Unable to create global regex set"); } - pub(crate) static ID_CALLBACK_WITH_HEADER: usize = 0; - pub(crate) static ID_COMPLEX_QUERY_PARAM: usize = 1; - pub(crate) static ID_ENUM_IN_PATH_PATH_PARAM: usize = 2; + pub(crate) static ID_ANY_OF: usize = 0; + pub(crate) static ID_CALLBACK_WITH_HEADER: usize = 1; + pub(crate) static ID_COMPLEX_QUERY_PARAM: usize = 2; + pub(crate) static ID_ENUM_IN_PATH_PATH_PARAM: usize = 3; lazy_static! { pub static ref REGEX_ENUM_IN_PATH_PATH_PARAM: regex::Regex = regex::Regex::new(r"^/enum_in_path/(?P[^/?#]*)$") .expect("Unable to create regex for ENUM_IN_PATH_PATH_PARAM"); } - pub(crate) static ID_JSON_COMPLEX_QUERY_PARAM: usize = 3; - pub(crate) static ID_MANDATORY_REQUEST_HEADER: usize = 4; - pub(crate) static ID_MERGE_PATCH_JSON: usize = 5; - pub(crate) static ID_MULTIGET: usize = 6; - pub(crate) static ID_MULTIPLE_AUTH_SCHEME: usize = 7; - pub(crate) static ID_OVERRIDE_SERVER: usize = 8; - pub(crate) static ID_PARAMGET: usize = 9; - pub(crate) static ID_READONLY_AUTH_SCHEME: usize = 10; - pub(crate) static ID_REGISTER_CALLBACK: usize = 11; - pub(crate) static ID_REPOS: usize = 12; - pub(crate) static ID_REPOS_REPOID: usize = 13; + pub(crate) static ID_JSON_COMPLEX_QUERY_PARAM: usize = 4; + pub(crate) static ID_MANDATORY_REQUEST_HEADER: usize = 5; + pub(crate) static ID_MERGE_PATCH_JSON: usize = 6; + pub(crate) static ID_MULTIGET: usize = 7; + pub(crate) static ID_MULTIPLE_AUTH_SCHEME: usize = 8; + pub(crate) static ID_ONE_OF: usize = 9; + pub(crate) static ID_OVERRIDE_SERVER: usize = 10; + pub(crate) static ID_PARAMGET: usize = 11; + pub(crate) static ID_READONLY_AUTH_SCHEME: usize = 12; + pub(crate) static ID_REGISTER_CALLBACK: usize = 13; + pub(crate) static ID_REPOS: usize = 14; + pub(crate) static ID_REPOS_REPOID: usize = 15; lazy_static! { pub static ref REGEX_REPOS_REPOID: regex::Regex = regex::Regex::new(r"^/repos/(?P[^/?#]*)$") .expect("Unable to create regex for REPOS_REPOID"); } - pub(crate) static ID_REQUIRED_OCTET_STREAM: usize = 14; - pub(crate) static ID_RESPONSES_WITH_HEADERS: usize = 15; - pub(crate) static ID_RFC7807: usize = 16; - pub(crate) static ID_UNTYPED_PROPERTY: usize = 17; - pub(crate) static ID_UUID: usize = 18; - pub(crate) static ID_XML: usize = 19; - pub(crate) static ID_XML_EXTRA: usize = 20; - pub(crate) static ID_XML_OTHER: usize = 21; + pub(crate) static ID_REQUIRED_OCTET_STREAM: usize = 16; + pub(crate) static ID_RESPONSES_WITH_HEADERS: usize = 17; + pub(crate) static ID_RFC7807: usize = 18; + pub(crate) static ID_UNTYPED_PROPERTY: usize = 19; + pub(crate) static ID_UUID: usize = 20; + pub(crate) static ID_XML: usize = 21; + pub(crate) static ID_XML_EXTRA: usize = 22; + pub(crate) static ID_XML_OTHER: usize = 23; } pub struct MakeService where @@ -216,6 +222,76 @@ impl hyper::service::Service<(Request, C)> for Service where match &method { + // AnyOfGet - GET /any-of + &hyper::Method::GET if path.matched(paths::ID_ANY_OF) => { + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::>(); + let param_any_of = query_params.iter().filter(|e| e.0 == "any-of").map(|e| e.1.to_owned()) + .filter_map(|param_any_of| param_any_of.parse().ok()) + .collect::>(); + let param_any_of = if !param_any_of.is_empty() { + Some(param_any_of) + } else { + None + }; + + let result = api_impl.any_of_get( + param_any_of.as_ref(), + &context + ).await; + let mut response = Response::new(Body::empty()); + response.headers_mut().insert( + HeaderName::from_static("x-span-id"), + HeaderValue::from_str((&context as &dyn Has).get().0.clone().to_string().as_str()) + .expect("Unable to create X-Span-ID header value")); + + match result { + Ok(rsp) => match rsp { + AnyOfGetResponse::Success + (body) + => { + *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); + response.headers_mut().insert( + CONTENT_TYPE, + HeaderValue::from_str("application/json") + .expect("Unable to create Content-Type header for ANY_OF_GET_SUCCESS")); + let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); + *response.body_mut() = Body::from(body); + }, + AnyOfGetResponse::AlternateSuccess + (body) + => { + *response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode"); + response.headers_mut().insert( + CONTENT_TYPE, + HeaderValue::from_str("application/json") + .expect("Unable to create Content-Type header for ANY_OF_GET_ALTERNATE_SUCCESS")); + let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); + *response.body_mut() = Body::from(body); + }, + AnyOfGetResponse::AnyOfSuccess + (body) + => { + *response.status_mut() = StatusCode::from_u16(202).expect("Unable to turn 202 into a StatusCode"); + response.headers_mut().insert( + CONTENT_TYPE, + HeaderValue::from_str("application/json") + .expect("Unable to create Content-Type header for ANY_OF_GET_ANY_OF_SUCCESS")); + let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); + *response.body_mut() = Body::from(body); + }, + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; + *response.body_mut() = Body::from("An internal error occurred"); + }, + } + + Ok(response) + }, + // CallbackWithHeaderPost - POST /callback-with-header &hyper::Method::POST if path.matched(paths::ID_CALLBACK_WITH_HEADER) => { // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) @@ -667,6 +743,42 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, + // OneOfGet - GET /one-of + &hyper::Method::GET if path.matched(paths::ID_ONE_OF) => { + let result = api_impl.one_of_get( + &context + ).await; + let mut response = Response::new(Body::empty()); + response.headers_mut().insert( + HeaderName::from_static("x-span-id"), + HeaderValue::from_str((&context as &dyn Has).get().0.clone().to_string().as_str()) + .expect("Unable to create X-Span-ID header value")); + + match result { + Ok(rsp) => match rsp { + OneOfGetResponse::Success + (body) + => { + *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); + response.headers_mut().insert( + CONTENT_TYPE, + HeaderValue::from_str("application/json") + .expect("Unable to create Content-Type header for ONE_OF_GET_SUCCESS")); + let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); + *response.body_mut() = Body::from(body); + }, + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; + *response.body_mut() = Body::from("An internal error occurred"); + }, + } + + Ok(response) + }, + // OverrideServerGet - GET /override-server &hyper::Method::GET if path.matched(paths::ID_OVERRIDE_SERVER) => { let result = api_impl.override_server_get( @@ -1722,6 +1834,7 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, + _ if path.matched(paths::ID_ANY_OF) => method_not_allowed(), _ if path.matched(paths::ID_CALLBACK_WITH_HEADER) => method_not_allowed(), _ if path.matched(paths::ID_COMPLEX_QUERY_PARAM) => method_not_allowed(), _ if path.matched(paths::ID_ENUM_IN_PATH_PATH_PARAM) => method_not_allowed(), @@ -1730,6 +1843,7 @@ impl hyper::service::Service<(Request, C)> for Service where _ if path.matched(paths::ID_MERGE_PATCH_JSON) => method_not_allowed(), _ if path.matched(paths::ID_MULTIGET) => method_not_allowed(), _ if path.matched(paths::ID_MULTIPLE_AUTH_SCHEME) => method_not_allowed(), + _ if path.matched(paths::ID_ONE_OF) => method_not_allowed(), _ if path.matched(paths::ID_OVERRIDE_SERVER) => method_not_allowed(), _ if path.matched(paths::ID_PARAMGET) => method_not_allowed(), _ if path.matched(paths::ID_READONLY_AUTH_SCHEME) => method_not_allowed(), @@ -1757,6 +1871,8 @@ impl RequestParser for ApiRequestParser { fn parse_operation_id(request: &Request) -> Result<&'static str, ()> { let path = paths::GLOBAL_REGEX_SET.matches(request.uri().path()); match request.method() { + // AnyOfGet - GET /any-of + &hyper::Method::GET if path.matched(paths::ID_ANY_OF) => Ok("AnyOfGet"), // CallbackWithHeaderPost - POST /callback-with-header &hyper::Method::POST if path.matched(paths::ID_CALLBACK_WITH_HEADER) => Ok("CallbackWithHeaderPost"), // ComplexQueryParamGet - GET /complex-query-param @@ -1773,6 +1889,8 @@ impl RequestParser for ApiRequestParser { &hyper::Method::GET if path.matched(paths::ID_MULTIGET) => Ok("MultigetGet"), // MultipleAuthSchemeGet - GET /multiple_auth_scheme &hyper::Method::GET if path.matched(paths::ID_MULTIPLE_AUTH_SCHEME) => Ok("MultipleAuthSchemeGet"), + // OneOfGet - GET /one-of + &hyper::Method::GET if path.matched(paths::ID_ONE_OF) => Ok("OneOfGet"), // OverrideServerGet - GET /override-server &hyper::Method::GET if path.matched(paths::ID_OVERRIDE_SERVER) => Ok("OverrideServerGet"), // ParamgetGet - GET /paramget diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/models.rs b/samples/server/petstore/rust-server/output/ops-v3/src/models.rs index aaf4182a33e..cf82e33947d 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/models.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/models.rs @@ -3,4 +3,3 @@ use crate::models; #[cfg(any(feature = "client", feature = "server"))] use crate::header; - diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs index 12dd045e216..1c4d90d71d8 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs @@ -4,46 +4,6 @@ use crate::models; #[cfg(any(feature = "client", feature = "server"))] use crate::header; - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for AdditionalPropertiesClass - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into AdditionalPropertiesClass - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct AdditionalPropertiesClass { @@ -127,44 +87,34 @@ impl std::str::FromStr for AdditionalPropertiesClass { } } - -impl AdditionalPropertiesClass { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for Animal - value: {} is invalid {}", + format!("Invalid header value for AdditionalPropertiesClass - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into Animal - {}", + format!("Unable to convert header value '{}' into AdditionalPropertiesClass - {}", value, err)) } }, @@ -176,6 +126,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl AdditionalPropertiesClass { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct Animal { @@ -245,8 +204,8 @@ impl std::str::FromStr for Animal { if let Some(key) = key_result { match key { - "className" => intermediate_rep.class_name.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "color" => intermediate_rep.color.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "className" => intermediate_rep.class_name.push(::from_str(val).map_err(|x| format!("{}", x))?), + "color" => intermediate_rep.color.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing Animal".to_string()) } } @@ -263,44 +222,34 @@ impl std::str::FromStr for Animal { } } - -impl Animal { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for AnimalFarm - value: {} is invalid {}", + format!("Invalid header value for Animal - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into AnimalFarm - {}", + format!("Unable to convert header value '{}' into Animal - {}", value, err)) } }, @@ -311,6 +260,16 @@ impl std::convert::TryFrom for header::IntoHeaderVal } } + +impl Animal { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct AnimalFarm( @@ -401,43 +360,34 @@ impl std::str::FromStr for AnimalFarm { } -impl AnimalFarm { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ApiResponse - value: {} is invalid {}", + format!("Invalid header value for AnimalFarm - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ApiResponse - {}", + format!("Unable to convert header value '{}' into AnimalFarm - {}", value, err)) } }, @@ -449,6 +399,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl AnimalFarm { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ApiResponse { @@ -533,9 +492,9 @@ impl std::str::FromStr for ApiResponse { if let Some(key) = key_result { match key { - "code" => intermediate_rep.code.push(i32::from_str(val).map_err(|x| format!("{}", x))?), - "type" => intermediate_rep.type_.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "message" => intermediate_rep.message.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "code" => intermediate_rep.code.push(::from_str(val).map_err(|x| format!("{}", x))?), + "type" => intermediate_rep.type_.push(::from_str(val).map_err(|x| format!("{}", x))?), + "message" => intermediate_rep.message.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing ApiResponse".to_string()) } } @@ -553,44 +512,34 @@ impl std::str::FromStr for ApiResponse { } } - -impl ApiResponse { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ArrayOfArrayOfNumberOnly - value: {} is invalid {}", + format!("Invalid header value for ApiResponse - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ArrayOfArrayOfNumberOnly - {}", + format!("Unable to convert header value '{}' into ApiResponse - {}", value, err)) } }, @@ -602,6 +551,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl ApiResponse { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ArrayOfArrayOfNumberOnly { @@ -674,44 +632,34 @@ impl std::str::FromStr for ArrayOfArrayOfNumberOnly { } } - -impl ArrayOfArrayOfNumberOnly { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ArrayOfNumberOnly - value: {} is invalid {}", + format!("Invalid header value for ArrayOfArrayOfNumberOnly - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ArrayOfNumberOnly - {}", + format!("Unable to convert header value '{}' into ArrayOfArrayOfNumberOnly - {}", value, err)) } }, @@ -723,6 +671,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl ArrayOfArrayOfNumberOnly { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ArrayOfNumberOnly { @@ -799,44 +756,34 @@ impl std::str::FromStr for ArrayOfNumberOnly { } } - -impl ArrayOfNumberOnly { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ArrayTest - value: {} is invalid {}", + format!("Invalid header value for ArrayOfNumberOnly - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ArrayTest - {}", + format!("Unable to convert header value '{}' into ArrayOfNumberOnly - {}", value, err)) } }, @@ -848,6 +795,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl ArrayOfNumberOnly { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ArrayTest { @@ -959,44 +915,34 @@ impl std::str::FromStr for ArrayTest { } } - -impl ArrayTest { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for Capitalization - value: {} is invalid {}", + format!("Invalid header value for ArrayTest - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into Capitalization - {}", + format!("Unable to convert header value '{}' into ArrayTest - {}", value, err)) } }, @@ -1008,6 +954,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl ArrayTest { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct Capitalization { @@ -1129,12 +1084,12 @@ impl std::str::FromStr for Capitalization { if let Some(key) = key_result { match key { - "smallCamel" => intermediate_rep.small_camel.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "CapitalCamel" => intermediate_rep.capital_camel.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "small_Snake" => intermediate_rep.small_snake.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "Capital_Snake" => intermediate_rep.capital_snake.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "SCA_ETH_Flow_Points" => intermediate_rep.sca_eth_flow_points.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "ATT_NAME" => intermediate_rep.att_name.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "smallCamel" => intermediate_rep.small_camel.push(::from_str(val).map_err(|x| format!("{}", x))?), + "CapitalCamel" => intermediate_rep.capital_camel.push(::from_str(val).map_err(|x| format!("{}", x))?), + "small_Snake" => intermediate_rep.small_snake.push(::from_str(val).map_err(|x| format!("{}", x))?), + "Capital_Snake" => intermediate_rep.capital_snake.push(::from_str(val).map_err(|x| format!("{}", x))?), + "SCA_ETH_Flow_Points" => intermediate_rep.sca_eth_flow_points.push(::from_str(val).map_err(|x| format!("{}", x))?), + "ATT_NAME" => intermediate_rep.att_name.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing Capitalization".to_string()) } } @@ -1155,44 +1110,34 @@ impl std::str::FromStr for Capitalization { } } - -impl Capitalization { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for Cat - value: {} is invalid {}", + format!("Invalid header value for Capitalization - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into Cat - {}", + format!("Unable to convert header value '{}' into Capitalization - {}", value, err)) } }, @@ -1204,6 +1149,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl Capitalization { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct Cat { @@ -1285,9 +1239,9 @@ impl std::str::FromStr for Cat { if let Some(key) = key_result { match key { - "className" => intermediate_rep.class_name.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "color" => intermediate_rep.color.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "declawed" => intermediate_rep.declawed.push(bool::from_str(val).map_err(|x| format!("{}", x))?), + "className" => intermediate_rep.class_name.push(::from_str(val).map_err(|x| format!("{}", x))?), + "color" => intermediate_rep.color.push(::from_str(val).map_err(|x| format!("{}", x))?), + "declawed" => intermediate_rep.declawed.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing Cat".to_string()) } } @@ -1305,44 +1259,34 @@ impl std::str::FromStr for Cat { } } - -impl Cat { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for CatAllOf - value: {} is invalid {}", + format!("Invalid header value for Cat - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into CatAllOf - {}", + format!("Unable to convert header value '{}' into Cat - {}", value, err)) } }, @@ -1354,6 +1298,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl Cat { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct CatAllOf { @@ -1414,7 +1367,7 @@ impl std::str::FromStr for CatAllOf { if let Some(key) = key_result { match key { - "declawed" => intermediate_rep.declawed.push(bool::from_str(val).map_err(|x| format!("{}", x))?), + "declawed" => intermediate_rep.declawed.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing CatAllOf".to_string()) } } @@ -1430,44 +1383,34 @@ impl std::str::FromStr for CatAllOf { } } - -impl CatAllOf { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for Category - value: {} is invalid {}", + format!("Invalid header value for CatAllOf - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into Category - {}", + format!("Unable to convert header value '{}' into CatAllOf - {}", value, err)) } }, @@ -1479,6 +1422,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl CatAllOf { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "Category")] @@ -1552,8 +1504,8 @@ impl std::str::FromStr for Category { if let Some(key) = key_result { match key { - "id" => intermediate_rep.id.push(i64::from_str(val).map_err(|x| format!("{}", x))?), - "name" => intermediate_rep.name.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "id" => intermediate_rep.id.push(::from_str(val).map_err(|x| format!("{}", x))?), + "name" => intermediate_rep.name.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing Category".to_string()) } } @@ -1570,45 +1522,34 @@ impl std::str::FromStr for Category { } } - -impl Category { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -/// Model for testing model with \"_class\" property -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ClassModel - value: {} is invalid {}", + format!("Invalid header value for Category - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ClassModel - {}", + format!("Unable to convert header value '{}' into Category - {}", value, err)) } }, @@ -1620,6 +1561,16 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl Category { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + +/// Model for testing model with \"_class\" property #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ClassModel { @@ -1680,7 +1631,7 @@ impl std::str::FromStr for ClassModel { if let Some(key) = key_result { match key { - "_class" => intermediate_rep._class.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "_class" => intermediate_rep._class.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing ClassModel".to_string()) } } @@ -1696,44 +1647,34 @@ impl std::str::FromStr for ClassModel { } } - -impl ClassModel { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for Client - value: {} is invalid {}", + format!("Invalid header value for ClassModel - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into Client - {}", + format!("Unable to convert header value '{}' into ClassModel - {}", value, err)) } }, @@ -1745,6 +1686,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl ClassModel { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct Client { @@ -1805,7 +1755,7 @@ impl std::str::FromStr for Client { if let Some(key) = key_result { match key { - "client" => intermediate_rep.client.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "client" => intermediate_rep.client.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing Client".to_string()) } } @@ -1821,44 +1771,34 @@ impl std::str::FromStr for Client { } } - -impl Client { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for Dog - value: {} is invalid {}", + format!("Invalid header value for Client - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into Dog - {}", + format!("Unable to convert header value '{}' into Client - {}", value, err)) } }, @@ -1870,6 +1810,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl Client { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct Dog { @@ -1951,9 +1900,9 @@ impl std::str::FromStr for Dog { if let Some(key) = key_result { match key { - "className" => intermediate_rep.class_name.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "color" => intermediate_rep.color.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "breed" => intermediate_rep.breed.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "className" => intermediate_rep.class_name.push(::from_str(val).map_err(|x| format!("{}", x))?), + "color" => intermediate_rep.color.push(::from_str(val).map_err(|x| format!("{}", x))?), + "breed" => intermediate_rep.breed.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing Dog".to_string()) } } @@ -1971,44 +1920,34 @@ impl std::str::FromStr for Dog { } } - -impl Dog { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for DogAllOf - value: {} is invalid {}", + format!("Invalid header value for Dog - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into DogAllOf - {}", + format!("Unable to convert header value '{}' into Dog - {}", value, err)) } }, @@ -2020,6 +1959,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl Dog { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct DogAllOf { @@ -2080,7 +2028,7 @@ impl std::str::FromStr for DogAllOf { if let Some(key) = key_result { match key { - "breed" => intermediate_rep.breed.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "breed" => intermediate_rep.breed.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing DogAllOf".to_string()) } } @@ -2096,44 +2044,34 @@ impl std::str::FromStr for DogAllOf { } } - -impl DogAllOf { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for EnumArrays - value: {} is invalid {}", + format!("Invalid header value for DogAllOf - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into EnumArrays - {}", + format!("Unable to convert header value '{}' into DogAllOf - {}", value, err)) } }, @@ -2145,6 +2083,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl DogAllOf { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct EnumArrays { @@ -2228,7 +2175,7 @@ impl std::str::FromStr for EnumArrays { if let Some(key) = key_result { match key { - "just_symbol" => intermediate_rep.just_symbol.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "just_symbol" => intermediate_rep.just_symbol.push(::from_str(val).map_err(|x| format!("{}", x))?), "array_enum" => return std::result::Result::Err("Parsing a container in this style is not supported in EnumArrays".to_string()), "array_array_enum" => return std::result::Result::Err("Parsing a container in this style is not supported in EnumArrays".to_string()), _ => return std::result::Result::Err("Unexpected key while parsing EnumArrays".to_string()) @@ -2248,6 +2195,44 @@ impl std::str::FromStr for EnumArrays { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for EnumArrays - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into EnumArrays - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + impl EnumArrays { /// Helper function to allow us to convert this model to an XML string. @@ -2265,7 +2250,7 @@ impl EnumArrays { #[repr(C)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk_enum_derive::LabelledGenericEnum))] -pub enum EnumClass { +pub enum EnumClass { #[serde(rename = "_abc")] _ABC, #[serde(rename = "-efg")] @@ -2276,7 +2261,7 @@ pub enum EnumClass { impl std::fmt::Display for EnumClass { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match *self { + match *self { EnumClass::_ABC => write!(f, "{}", "_abc"), EnumClass::_EFG => write!(f, "{}", "-efg"), EnumClass::_XYZ_ => write!(f, "{}", "(xyz)"), @@ -2306,45 +2291,6 @@ impl EnumClass { } } -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for EnumTest - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into EnumTest - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct EnumTest { @@ -2450,11 +2396,11 @@ impl std::str::FromStr for EnumTest { if let Some(key) = key_result { match key { - "enum_string" => intermediate_rep.enum_string.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "enum_string_required" => intermediate_rep.enum_string_required.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "enum_integer" => intermediate_rep.enum_integer.push(i32::from_str(val).map_err(|x| format!("{}", x))?), - "enum_number" => intermediate_rep.enum_number.push(f64::from_str(val).map_err(|x| format!("{}", x))?), - "outerEnum" => intermediate_rep.outer_enum.push(models::OuterEnum::from_str(val).map_err(|x| format!("{}", x))?), + "enum_string" => intermediate_rep.enum_string.push(::from_str(val).map_err(|x| format!("{}", x))?), + "enum_string_required" => intermediate_rep.enum_string_required.push(::from_str(val).map_err(|x| format!("{}", x))?), + "enum_integer" => intermediate_rep.enum_integer.push(::from_str(val).map_err(|x| format!("{}", x))?), + "enum_number" => intermediate_rep.enum_number.push(::from_str(val).map_err(|x| format!("{}", x))?), + "outerEnum" => intermediate_rep.outer_enum.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing EnumTest".to_string()) } } @@ -2474,44 +2420,34 @@ impl std::str::FromStr for EnumTest { } } - -impl EnumTest { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for FormatTest - value: {} is invalid {}", + format!("Invalid header value for EnumTest - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into FormatTest - {}", + format!("Unable to convert header value '{}' into EnumTest - {}", value, err)) } }, @@ -2523,6 +2459,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl EnumTest { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct FormatTest { @@ -2701,19 +2646,19 @@ impl std::str::FromStr for FormatTest { if let Some(key) = key_result { match key { - "integer" => intermediate_rep.integer.push(u8::from_str(val).map_err(|x| format!("{}", x))?), - "int32" => intermediate_rep.int32.push(u32::from_str(val).map_err(|x| format!("{}", x))?), - "int64" => intermediate_rep.int64.push(i64::from_str(val).map_err(|x| format!("{}", x))?), - "number" => intermediate_rep.number.push(f64::from_str(val).map_err(|x| format!("{}", x))?), - "float" => intermediate_rep.float.push(f32::from_str(val).map_err(|x| format!("{}", x))?), - "double" => intermediate_rep.double.push(f64::from_str(val).map_err(|x| format!("{}", x))?), - "string" => intermediate_rep.string.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "integer" => intermediate_rep.integer.push(::from_str(val).map_err(|x| format!("{}", x))?), + "int32" => intermediate_rep.int32.push(::from_str(val).map_err(|x| format!("{}", x))?), + "int64" => intermediate_rep.int64.push(::from_str(val).map_err(|x| format!("{}", x))?), + "number" => intermediate_rep.number.push(::from_str(val).map_err(|x| format!("{}", x))?), + "float" => intermediate_rep.float.push(::from_str(val).map_err(|x| format!("{}", x))?), + "double" => intermediate_rep.double.push(::from_str(val).map_err(|x| format!("{}", x))?), + "string" => intermediate_rep.string.push(::from_str(val).map_err(|x| format!("{}", x))?), "byte" => return std::result::Result::Err("Parsing binary data in this style is not supported in FormatTest".to_string()), "binary" => return std::result::Result::Err("Parsing binary data in this style is not supported in FormatTest".to_string()), - "date" => intermediate_rep.date.push(chrono::DateTime::::from_str(val).map_err(|x| format!("{}", x))?), - "dateTime" => intermediate_rep.date_time.push(chrono::DateTime::::from_str(val).map_err(|x| format!("{}", x))?), - "uuid" => intermediate_rep.uuid.push(uuid::Uuid::from_str(val).map_err(|x| format!("{}", x))?), - "password" => intermediate_rep.password.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "date" => intermediate_rep.date.push( as std::str::FromStr>::from_str(val).map_err(|x| format!("{}", x))?), + "dateTime" => intermediate_rep.date_time.push( as std::str::FromStr>::from_str(val).map_err(|x| format!("{}", x))?), + "uuid" => intermediate_rep.uuid.push(::from_str(val).map_err(|x| format!("{}", x))?), + "password" => intermediate_rep.password.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing FormatTest".to_string()) } } @@ -2741,44 +2686,34 @@ impl std::str::FromStr for FormatTest { } } - -impl FormatTest { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for HasOnlyReadOnly - value: {} is invalid {}", + format!("Invalid header value for FormatTest - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into HasOnlyReadOnly - {}", + format!("Unable to convert header value '{}' into FormatTest - {}", value, err)) } }, @@ -2790,6 +2725,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl FormatTest { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct HasOnlyReadOnly { @@ -2862,8 +2806,8 @@ impl std::str::FromStr for HasOnlyReadOnly { if let Some(key) = key_result { match key { - "bar" => intermediate_rep.bar.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "foo" => intermediate_rep.foo.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "bar" => intermediate_rep.bar.push(::from_str(val).map_err(|x| format!("{}", x))?), + "foo" => intermediate_rep.foo.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing HasOnlyReadOnly".to_string()) } } @@ -2880,44 +2824,34 @@ impl std::str::FromStr for HasOnlyReadOnly { } } - -impl HasOnlyReadOnly { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for List - value: {} is invalid {}", + format!("Invalid header value for HasOnlyReadOnly - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into List - {}", + format!("Unable to convert header value '{}' into HasOnlyReadOnly - {}", value, err)) } }, @@ -2929,6 +2863,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl HasOnlyReadOnly { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct List { @@ -2989,7 +2932,7 @@ impl std::str::FromStr for List { if let Some(key) = key_result { match key { - "123-list" => intermediate_rep.param_123_list.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "123-list" => intermediate_rep.param_123_list.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing List".to_string()) } } @@ -3005,44 +2948,34 @@ impl std::str::FromStr for List { } } - -impl List { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for MapTest - value: {} is invalid {}", + format!("Invalid header value for List - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into MapTest - {}", + format!("Unable to convert header value '{}' into List - {}", value, err)) } }, @@ -3054,6 +2987,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl List { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct MapTest { @@ -3150,44 +3092,34 @@ impl std::str::FromStr for MapTest { } } - -impl MapTest { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for MixedPropertiesAndAdditionalPropertiesClass - value: {} is invalid {}", + format!("Invalid header value for MapTest - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into MixedPropertiesAndAdditionalPropertiesClass - {}", + format!("Unable to convert header value '{}' into MapTest - {}", value, err)) } }, @@ -3199,6 +3131,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl MapTest { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct MixedPropertiesAndAdditionalPropertiesClass { @@ -3272,8 +3213,8 @@ impl std::str::FromStr for MixedPropertiesAndAdditionalPropertiesClass { if let Some(key) = key_result { match key { - "uuid" => intermediate_rep.uuid.push(uuid::Uuid::from_str(val).map_err(|x| format!("{}", x))?), - "dateTime" => intermediate_rep.date_time.push(chrono::DateTime::::from_str(val).map_err(|x| format!("{}", x))?), + "uuid" => intermediate_rep.uuid.push(::from_str(val).map_err(|x| format!("{}", x))?), + "dateTime" => intermediate_rep.date_time.push( as std::str::FromStr>::from_str(val).map_err(|x| format!("{}", x))?), "map" => return std::result::Result::Err("Parsing a container in this style is not supported in MixedPropertiesAndAdditionalPropertiesClass".to_string()), _ => return std::result::Result::Err("Unexpected key while parsing MixedPropertiesAndAdditionalPropertiesClass".to_string()) } @@ -3292,45 +3233,34 @@ impl std::str::FromStr for MixedPropertiesAndAdditionalPropertiesClass { } } - -impl MixedPropertiesAndAdditionalPropertiesClass { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -/// Model for testing model name starting with number -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for Model200Response - value: {} is invalid {}", + format!("Invalid header value for MixedPropertiesAndAdditionalPropertiesClass - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into Model200Response - {}", + format!("Unable to convert header value '{}' into MixedPropertiesAndAdditionalPropertiesClass - {}", value, err)) } }, @@ -3342,6 +3272,16 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl MixedPropertiesAndAdditionalPropertiesClass { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + +/// Model for testing model name starting with number #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "Name")] @@ -3415,8 +3355,8 @@ impl std::str::FromStr for Model200Response { if let Some(key) = key_result { match key { - "name" => intermediate_rep.name.push(i32::from_str(val).map_err(|x| format!("{}", x))?), - "class" => intermediate_rep.class.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "name" => intermediate_rep.name.push(::from_str(val).map_err(|x| format!("{}", x))?), + "class" => intermediate_rep.class.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing Model200Response".to_string()) } } @@ -3433,45 +3373,34 @@ impl std::str::FromStr for Model200Response { } } - -impl Model200Response { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -/// Model for testing reserved words -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ModelReturn - value: {} is invalid {}", + format!("Invalid header value for Model200Response - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ModelReturn - {}", + format!("Unable to convert header value '{}' into Model200Response - {}", value, err)) } }, @@ -3483,6 +3412,16 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl Model200Response { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + +/// Model for testing reserved words #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "Return")] @@ -3544,7 +3483,7 @@ impl std::str::FromStr for ModelReturn { if let Some(key) = key_result { match key { - "return" => intermediate_rep.return_.push(i32::from_str(val).map_err(|x| format!("{}", x))?), + "return" => intermediate_rep.return_.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing ModelReturn".to_string()) } } @@ -3560,45 +3499,34 @@ impl std::str::FromStr for ModelReturn { } } - -impl ModelReturn { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -/// Model for testing model name same as property name -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for Name - value: {} is invalid {}", + format!("Invalid header value for ModelReturn - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into Name - {}", + format!("Unable to convert header value '{}' into ModelReturn - {}", value, err)) } }, @@ -3610,6 +3538,16 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl ModelReturn { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + +/// Model for testing model name same as property name #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "Name")] @@ -3704,10 +3642,10 @@ impl std::str::FromStr for Name { if let Some(key) = key_result { match key { - "name" => intermediate_rep.name.push(i32::from_str(val).map_err(|x| format!("{}", x))?), - "snake_case" => intermediate_rep.snake_case.push(i32::from_str(val).map_err(|x| format!("{}", x))?), - "property" => intermediate_rep.property.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "123Number" => intermediate_rep.param_123_number.push(isize::from_str(val).map_err(|x| format!("{}", x))?), + "name" => intermediate_rep.name.push(::from_str(val).map_err(|x| format!("{}", x))?), + "snake_case" => intermediate_rep.snake_case.push(::from_str(val).map_err(|x| format!("{}", x))?), + "property" => intermediate_rep.property.push(::from_str(val).map_err(|x| format!("{}", x))?), + "123Number" => intermediate_rep.param_123_number.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing Name".to_string()) } } @@ -3726,44 +3664,34 @@ impl std::str::FromStr for Name { } } - -impl Name { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for NumberOnly - value: {} is invalid {}", + format!("Invalid header value for Name - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into NumberOnly - {}", + format!("Unable to convert header value '{}' into Name - {}", value, err)) } }, @@ -3775,6 +3703,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl Name { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct NumberOnly { @@ -3835,7 +3772,7 @@ impl std::str::FromStr for NumberOnly { if let Some(key) = key_result { match key { - "JustNumber" => intermediate_rep.just_number.push(f64::from_str(val).map_err(|x| format!("{}", x))?), + "JustNumber" => intermediate_rep.just_number.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing NumberOnly".to_string()) } } @@ -3851,44 +3788,34 @@ impl std::str::FromStr for NumberOnly { } } - -impl NumberOnly { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ObjectContainingObjectWithOnlyAdditionalProperties - value: {} is invalid {}", + format!("Invalid header value for NumberOnly - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ObjectContainingObjectWithOnlyAdditionalProperties - {}", + format!("Unable to convert header value '{}' into NumberOnly - {}", value, err)) } }, @@ -3900,6 +3827,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl NumberOnly { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ObjectContainingObjectWithOnlyAdditionalProperties { @@ -3956,7 +3892,7 @@ impl std::str::FromStr for ObjectContainingObjectWithOnlyAdditionalProperties { if let Some(key) = key_result { match key { - "inner" => intermediate_rep.inner.push(models::ObjectWithOnlyAdditionalProperties::from_str(val).map_err(|x| format!("{}", x))?), + "inner" => intermediate_rep.inner.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing ObjectContainingObjectWithOnlyAdditionalProperties".to_string()) } } @@ -3972,6 +3908,44 @@ impl std::str::FromStr for ObjectContainingObjectWithOnlyAdditionalProperties { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for ObjectContainingObjectWithOnlyAdditionalProperties - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into ObjectContainingObjectWithOnlyAdditionalProperties - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + impl ObjectContainingObjectWithOnlyAdditionalProperties { /// Helper function to allow us to convert this model to an XML string. @@ -3992,7 +3966,6 @@ impl std::convert::From> for ObjectWit } } - impl std::convert::From for std::collections::HashMap { fn from(x: ObjectWithOnlyAdditionalProperties) -> Self { x.0 @@ -4042,45 +4015,6 @@ impl ObjectWithOnlyAdditionalProperties { } } -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for Order - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into Order - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "Order")] @@ -4200,12 +4134,12 @@ impl std::str::FromStr for Order { if let Some(key) = key_result { match key { - "id" => intermediate_rep.id.push(i64::from_str(val).map_err(|x| format!("{}", x))?), - "petId" => intermediate_rep.pet_id.push(i64::from_str(val).map_err(|x| format!("{}", x))?), - "quantity" => intermediate_rep.quantity.push(i32::from_str(val).map_err(|x| format!("{}", x))?), - "shipDate" => intermediate_rep.ship_date.push(chrono::DateTime::::from_str(val).map_err(|x| format!("{}", x))?), - "status" => intermediate_rep.status.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "complete" => intermediate_rep.complete.push(bool::from_str(val).map_err(|x| format!("{}", x))?), + "id" => intermediate_rep.id.push(::from_str(val).map_err(|x| format!("{}", x))?), + "petId" => intermediate_rep.pet_id.push(::from_str(val).map_err(|x| format!("{}", x))?), + "quantity" => intermediate_rep.quantity.push(::from_str(val).map_err(|x| format!("{}", x))?), + "shipDate" => intermediate_rep.ship_date.push( as std::str::FromStr>::from_str(val).map_err(|x| format!("{}", x))?), + "status" => intermediate_rep.status.push(::from_str(val).map_err(|x| format!("{}", x))?), + "complete" => intermediate_rep.complete.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing Order".to_string()) } } @@ -4226,6 +4160,44 @@ impl std::str::FromStr for Order { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for Order - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into Order - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + impl Order { /// Helper function to allow us to convert this model to an XML string. @@ -4246,7 +4218,6 @@ impl std::convert::From for OuterBoolean { } } - impl std::convert::From for bool { fn from(x: OuterBoolean) -> Self { x.0 @@ -4276,45 +4247,6 @@ impl OuterBoolean { } } -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for OuterComposite - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into OuterComposite - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct OuterComposite { @@ -4399,9 +4331,9 @@ impl std::str::FromStr for OuterComposite { if let Some(key) = key_result { match key { - "my_number" => intermediate_rep.my_number.push(f64::from_str(val).map_err(|x| format!("{}", x))?), - "my_string" => intermediate_rep.my_string.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "my_boolean" => intermediate_rep.my_boolean.push(bool::from_str(val).map_err(|x| format!("{}", x))?), + "my_number" => intermediate_rep.my_number.push(::from_str(val).map_err(|x| format!("{}", x))?), + "my_string" => intermediate_rep.my_string.push(::from_str(val).map_err(|x| format!("{}", x))?), + "my_boolean" => intermediate_rep.my_boolean.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing OuterComposite".to_string()) } } @@ -4419,6 +4351,44 @@ impl std::str::FromStr for OuterComposite { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for OuterComposite - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into OuterComposite - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + impl OuterComposite { /// Helper function to allow us to convert this model to an XML string. @@ -4436,7 +4406,7 @@ impl OuterComposite { #[repr(C)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk_enum_derive::LabelledGenericEnum))] -pub enum OuterEnum { +pub enum OuterEnum { #[serde(rename = "placed")] PLACED, #[serde(rename = "approved")] @@ -4447,7 +4417,7 @@ pub enum OuterEnum { impl std::fmt::Display for OuterEnum { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match *self { + match *self { OuterEnum::PLACED => write!(f, "{}", "placed"), OuterEnum::APPROVED => write!(f, "{}", "approved"), OuterEnum::DELIVERED => write!(f, "{}", "delivered"), @@ -4487,7 +4457,6 @@ impl std::convert::From for OuterNumber { } } - impl std::convert::From for f64 { fn from(x: OuterNumber) -> Self { x.0 @@ -4569,45 +4538,6 @@ impl OuterString { } } -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for Pet - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into Pet - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "Pet")] @@ -4717,12 +4647,12 @@ impl std::str::FromStr for Pet { if let Some(key) = key_result { match key { - "id" => intermediate_rep.id.push(i64::from_str(val).map_err(|x| format!("{}", x))?), - "category" => intermediate_rep.category.push(models::Category::from_str(val).map_err(|x| format!("{}", x))?), - "name" => intermediate_rep.name.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "id" => intermediate_rep.id.push(::from_str(val).map_err(|x| format!("{}", x))?), + "category" => intermediate_rep.category.push(::from_str(val).map_err(|x| format!("{}", x))?), + "name" => intermediate_rep.name.push(::from_str(val).map_err(|x| format!("{}", x))?), "photoUrls" => return std::result::Result::Err("Parsing a container in this style is not supported in Pet".to_string()), "tags" => return std::result::Result::Err("Parsing a container in this style is not supported in Pet".to_string()), - "status" => intermediate_rep.status.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "status" => intermediate_rep.status.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing Pet".to_string()) } } @@ -4743,44 +4673,34 @@ impl std::str::FromStr for Pet { } } - -impl Pet { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ReadOnlyFirst - value: {} is invalid {}", + format!("Invalid header value for Pet - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ReadOnlyFirst - {}", + format!("Unable to convert header value '{}' into Pet - {}", value, err)) } }, @@ -4792,6 +4712,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl Pet { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ReadOnlyFirst { @@ -4864,8 +4793,8 @@ impl std::str::FromStr for ReadOnlyFirst { if let Some(key) = key_result { match key { - "bar" => intermediate_rep.bar.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "baz" => intermediate_rep.baz.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "bar" => intermediate_rep.bar.push(::from_str(val).map_err(|x| format!("{}", x))?), + "baz" => intermediate_rep.baz.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing ReadOnlyFirst".to_string()) } } @@ -4882,44 +4811,34 @@ impl std::str::FromStr for ReadOnlyFirst { } } - -impl ReadOnlyFirst { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for SpecialModelName - value: {} is invalid {}", + format!("Invalid header value for ReadOnlyFirst - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into SpecialModelName - {}", + format!("Unable to convert header value '{}' into ReadOnlyFirst - {}", value, err)) } }, @@ -4931,6 +4850,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl ReadOnlyFirst { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "$special[model.name]")] @@ -4992,7 +4920,7 @@ impl std::str::FromStr for SpecialModelName { if let Some(key) = key_result { match key { - "$special[property.name]" => intermediate_rep.special_property_name.push(i64::from_str(val).map_err(|x| format!("{}", x))?), + "$special[property.name]" => intermediate_rep.special_property_name.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing SpecialModelName".to_string()) } } @@ -5008,44 +4936,34 @@ impl std::str::FromStr for SpecialModelName { } } - -impl SpecialModelName { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for Tag - value: {} is invalid {}", + format!("Invalid header value for SpecialModelName - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into Tag - {}", + format!("Unable to convert header value '{}' into SpecialModelName - {}", value, err)) } }, @@ -5057,6 +4975,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl SpecialModelName { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "Tag")] @@ -5130,8 +5057,8 @@ impl std::str::FromStr for Tag { if let Some(key) = key_result { match key { - "id" => intermediate_rep.id.push(i64::from_str(val).map_err(|x| format!("{}", x))?), - "name" => intermediate_rep.name.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "id" => intermediate_rep.id.push(::from_str(val).map_err(|x| format!("{}", x))?), + "name" => intermediate_rep.name.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing Tag".to_string()) } } @@ -5148,44 +5075,34 @@ impl std::str::FromStr for Tag { } } - -impl Tag { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for User - value: {} is invalid {}", + format!("Invalid header value for Tag - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into User - {}", + format!("Unable to convert header value '{}' into Tag - {}", value, err)) } }, @@ -5197,6 +5114,15 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +impl Tag { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] #[serde(rename = "User")] @@ -5343,14 +5269,14 @@ impl std::str::FromStr for User { if let Some(key) = key_result { match key { - "id" => intermediate_rep.id.push(i64::from_str(val).map_err(|x| format!("{}", x))?), - "username" => intermediate_rep.username.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "firstName" => intermediate_rep.first_name.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "lastName" => intermediate_rep.last_name.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "email" => intermediate_rep.email.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "password" => intermediate_rep.password.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "phone" => intermediate_rep.phone.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "userStatus" => intermediate_rep.user_status.push(i32::from_str(val).map_err(|x| format!("{}", x))?), + "id" => intermediate_rep.id.push(::from_str(val).map_err(|x| format!("{}", x))?), + "username" => intermediate_rep.username.push(::from_str(val).map_err(|x| format!("{}", x))?), + "firstName" => intermediate_rep.first_name.push(::from_str(val).map_err(|x| format!("{}", x))?), + "lastName" => intermediate_rep.last_name.push(::from_str(val).map_err(|x| format!("{}", x))?), + "email" => intermediate_rep.email.push(::from_str(val).map_err(|x| format!("{}", x))?), + "password" => intermediate_rep.password.push(::from_str(val).map_err(|x| format!("{}", x))?), + "phone" => intermediate_rep.phone.push(::from_str(val).map_err(|x| format!("{}", x))?), + "userStatus" => intermediate_rep.user_status.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing User".to_string()) } } @@ -5373,6 +5299,44 @@ impl std::str::FromStr for User { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for User - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into User - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + impl User { /// Helper function to allow us to convert this model to an XML string. diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs index b8085bcd85a..5bb9c13acba 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs @@ -4,46 +4,6 @@ use crate::models; #[cfg(any(feature = "client", feature = "server"))] use crate::header; - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ANullableContainer - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ANullableContainer - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ANullableContainer { @@ -133,6 +93,43 @@ impl std::str::FromStr for ANullableContainer { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for ANullableContainer - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into ANullableContainer - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} /// An additionalPropertiesObject @@ -146,7 +143,6 @@ impl std::convert::From> for Additiona } } - impl std::convert::From for std::collections::HashMap { fn from(x: AdditionalPropertiesObject) -> Self { x.0 @@ -187,46 +183,6 @@ impl ::std::str::FromStr for AdditionalPropertiesObject { } } - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for AllOfObject - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into AllOfObject - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct AllOfObject { @@ -299,8 +255,8 @@ impl std::str::FromStr for AllOfObject { if let Some(key) = key_result { match key { - "sampleProperty" => intermediate_rep.sample_property.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "sampleBasePropery" => intermediate_rep.sample_base_propery.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "sampleProperty" => intermediate_rep.sample_property.push(::from_str(val).map_err(|x| format!("{}", x))?), + "sampleBasePropery" => intermediate_rep.sample_base_propery.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing AllOfObject".to_string()) } } @@ -317,36 +273,34 @@ impl std::str::FromStr for AllOfObject { } } - - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for BaseAllOf - value: {} is invalid {}", + format!("Invalid header value for AllOfObject - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into BaseAllOf - {}", + format!("Unable to convert header value '{}' into AllOfObject - {}", value, err)) } }, @@ -418,7 +372,7 @@ impl std::str::FromStr for BaseAllOf { if let Some(key) = key_result { match key { - "sampleBasePropery" => intermediate_rep.sample_base_propery.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "sampleBasePropery" => intermediate_rep.sample_base_propery.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing BaseAllOf".to_string()) } } @@ -434,37 +388,34 @@ impl std::str::FromStr for BaseAllOf { } } - - -/// structured response -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for GetYamlResponse - value: {} is invalid {}", + format!("Invalid header value for BaseAllOf - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into GetYamlResponse - {}", + format!("Unable to convert header value '{}' into BaseAllOf - {}", value, err)) } }, @@ -476,6 +427,7 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +/// structured response #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct GetYamlResponse { @@ -537,7 +489,7 @@ impl std::str::FromStr for GetYamlResponse { if let Some(key) = key_result { match key { - "value" => intermediate_rep.value.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "value" => intermediate_rep.value.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing GetYamlResponse".to_string()) } } @@ -553,36 +505,34 @@ impl std::str::FromStr for GetYamlResponse { } } - - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for InlineObject - value: {} is invalid {}", + format!("Invalid header value for GetYamlResponse - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into InlineObject - {}", + format!("Unable to convert header value '{}' into GetYamlResponse - {}", value, err)) } }, @@ -663,8 +613,8 @@ impl std::str::FromStr for InlineObject { if let Some(key) = key_result { match key { - "id" => intermediate_rep.id.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "password" => intermediate_rep.password.push(String::from_str(val).map_err(|x| format!("{}", x))?), + "id" => intermediate_rep.id.push(::from_str(val).map_err(|x| format!("{}", x))?), + "password" => intermediate_rep.password.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing InlineObject".to_string()) } } @@ -681,37 +631,34 @@ impl std::str::FromStr for InlineObject { } } - - -/// An object of objects -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ObjectOfObjects - value: {} is invalid {}", + format!("Invalid header value for InlineObject - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ObjectOfObjects - {}", + format!("Unable to convert header value '{}' into InlineObject - {}", value, err)) } }, @@ -723,6 +670,7 @@ impl std::convert::TryFrom for header::IntoHeaderVal } +/// An object of objects #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ObjectOfObjects { @@ -779,7 +727,7 @@ impl std::str::FromStr for ObjectOfObjects { if let Some(key) = key_result { match key { - "inner" => intermediate_rep.inner.push(models::ObjectOfObjectsInner::from_str(val).map_err(|x| format!("{}", x))?), + "inner" => intermediate_rep.inner.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing ObjectOfObjects".to_string()) } } @@ -795,36 +743,34 @@ impl std::str::FromStr for ObjectOfObjects { } } - - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for ObjectOfObjectsInner - value: {} is invalid {}", + format!("Invalid header value for ObjectOfObjects - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into ObjectOfObjectsInner - {}", + format!("Unable to convert header value '{}' into ObjectOfObjects - {}", value, err)) } }, @@ -905,8 +851,8 @@ impl std::str::FromStr for ObjectOfObjectsInner { if let Some(key) = key_result { match key { - "required_thing" => intermediate_rep.required_thing.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "optional_thing" => intermediate_rep.optional_thing.push(isize::from_str(val).map_err(|x| format!("{}", x))?), + "required_thing" => intermediate_rep.required_thing.push(::from_str(val).map_err(|x| format!("{}", x))?), + "optional_thing" => intermediate_rep.optional_thing.push(::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing ObjectOfObjectsInner".to_string()) } } @@ -923,4 +869,41 @@ impl std::str::FromStr for ObjectOfObjectsInner { } } +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for ObjectOfObjectsInner - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into ObjectOfObjectsInner - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} From 9286b43dfa9ea9b3cf2de16e170a72c3c15d7b8b Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 24 Jan 2021 14:20:40 +0800 Subject: [PATCH 24/54] remove the bin folder under kotlin samples (#8520) --- .../org/openapitools/client/apis/PetApi.kt | 374 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 198 --------- .../org/openapitools/client/apis/UserApi.kt | 363 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 -- .../client/infrastructure/ApiClient.kt | 251 ------------ .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 -- .../client/infrastructure/ByteArrayAdapter.kt | 33 -- .../client/infrastructure/DateAdapter.kt | 37 -- .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 35 -- .../infrastructure/LocalDateTimeAdapter.kt | 35 -- .../infrastructure/OffsetDateTimeAdapter.kt | 35 -- .../client/infrastructure/RequestConfig.kt | 16 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 -- .../client/infrastructure/Serializer.kt | 24 -- .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 -- .../org/openapitools/client/models/Order.kt | 54 --- .../org/openapitools/client/models/Pet.kt | 56 --- .../org/openapitools/client/models/Tag.kt | 29 -- .../org/openapitools/client/models/User.kt | 48 --- .../org/openapitools/client/Application.kt | 20 - .../org/openapitools/client/apis/PetApi.kt | 374 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 198 --------- .../org/openapitools/client/apis/UserApi.kt | 363 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 -- .../client/infrastructure/ApiClient.kt | 251 ------------ .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 -- .../client/infrastructure/ByteArrayAdapter.kt | 3 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/RequestConfig.kt | 16 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 -- .../client/infrastructure/Serializer.kt | 18 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 -- .../org/openapitools/client/models/Order.kt | 54 --- .../org/openapitools/client/models/Pet.kt | 56 --- .../org/openapitools/client/models/Tag.kt | 29 -- .../org/openapitools/client/models/User.kt | 48 --- .../org/openapitools/client/apis/PetApi.kt | 376 ------------------ .../org/openapitools/client/apis/StoreApi.kt | 198 --------- .../org/openapitools/client/apis/UserApi.kt | 363 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 -- .../client/infrastructure/ApiClient.kt | 245 ------------ .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 -- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 16 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 -- .../client/infrastructure/Serializer.kt | 23 -- .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 -- .../org/openapitools/client/models/Order.kt | 54 --- .../org/openapitools/client/models/Pet.kt | 56 --- .../org/openapitools/client/models/Tag.kt | 29 -- .../org/openapitools/client/models/User.kt | 48 --- .../org/openapitools/client/apis/PetApi.kt | 374 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 198 --------- .../org/openapitools/client/apis/UserApi.kt | 363 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 -- .../client/infrastructure/ApiClient.kt | 251 ------------ .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 -- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 16 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 -- .../client/infrastructure/Serializer.kt | 21 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 33 -- .../openapitools/client/models/Category.kt | 30 -- .../org/openapitools/client/models/Order.kt | 55 --- .../org/openapitools/client/models/Pet.kt | 57 --- .../org/openapitools/client/models/Tag.kt | 30 -- .../org/openapitools/client/models/User.kt | 49 --- .../org/openapitools/client/apis/PetApi.kt | 374 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 198 --------- .../org/openapitools/client/apis/UserApi.kt | 363 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 -- .../client/infrastructure/ApiClient.kt | 251 ------------ .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 -- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 16 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 -- .../client/infrastructure/Serializer.kt | 23 -- .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 -- .../org/openapitools/client/models/Order.kt | 54 --- .../org/openapitools/client/models/Pet.kt | 56 --- .../org/openapitools/client/models/Tag.kt | 29 -- .../org/openapitools/client/models/User.kt | 48 --- .../org/openapitools/client/apis/PetApi.kt | 374 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 198 --------- .../org/openapitools/client/apis/UserApi.kt | 363 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 -- .../client/infrastructure/ApiClient.kt | 251 ------------ .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 -- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 16 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 -- .../client/infrastructure/Serializer.kt | 23 -- .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 38 -- .../openapitools/client/models/Category.kt | 35 -- .../org/openapitools/client/models/Order.kt | 58 --- .../org/openapitools/client/models/Pet.kt | 60 --- .../org/openapitools/client/models/Tag.kt | 35 -- .../org/openapitools/client/models/User.kt | 54 --- .../org/openapitools/client/apis/PetApi.kt | 374 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 198 --------- .../org/openapitools/client/apis/UserApi.kt | 363 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 -- .../client/infrastructure/ApiClient.kt | 249 ------------ .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 -- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 16 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 -- .../client/infrastructure/Serializer.kt | 23 -- .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 -- .../org/openapitools/client/models/Order.kt | 54 --- .../org/openapitools/client/models/Pet.kt | 56 --- .../org/openapitools/client/models/Tag.kt | 29 -- .../org/openapitools/client/models/User.kt | 48 --- .../org/openapitools/client/apis/PetApi.kt | 125 ------ .../org/openapitools/client/apis/StoreApi.kt | 63 --- .../org/openapitools/client/apis/UserApi.kt | 114 ------ .../openapitools/client/auth/ApiKeyAuth.kt | 50 --- .../org/openapitools/client/auth/OAuth.kt | 151 ------- .../org/openapitools/client/auth/OAuthFlow.kt | 5 - .../client/auth/OAuthOkHttpClient.kt | 61 --- .../client/infrastructure/ApiClient.kt | 204 ---------- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../infrastructure/CollectionFormats.kt | 56 --- .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/ResponseExt.kt | 16 - .../client/infrastructure/Serializer.kt | 23 -- .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 -- .../org/openapitools/client/models/Order.kt | 54 --- .../org/openapitools/client/models/Pet.kt | 56 --- .../org/openapitools/client/models/Tag.kt | 29 -- .../org/openapitools/client/models/User.kt | 48 --- .../org/openapitools/client/apis/PetApi.kt | 124 ------ .../org/openapitools/client/apis/StoreApi.kt | 62 --- .../org/openapitools/client/apis/UserApi.kt | 113 ------ .../openapitools/client/auth/ApiKeyAuth.kt | 50 --- .../org/openapitools/client/auth/OAuth.kt | 151 ------- .../org/openapitools/client/auth/OAuthFlow.kt | 5 - .../client/auth/OAuthOkHttpClient.kt | 61 --- .../client/infrastructure/ApiClient.kt | 201 ---------- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../infrastructure/CollectionFormats.kt | 56 --- .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/ResponseExt.kt | 16 - .../client/infrastructure/Serializer.kt | 23 -- .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 -- .../org/openapitools/client/models/Order.kt | 54 --- .../org/openapitools/client/models/Pet.kt | 56 --- .../org/openapitools/client/models/Tag.kt | 29 -- .../org/openapitools/client/models/User.kt | 48 --- .../org/openapitools/client/apis/PetApi.kt | 374 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 198 --------- .../org/openapitools/client/apis/UserApi.kt | 363 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 -- .../client/infrastructure/ApiClient.kt | 251 ------------ .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 -- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 16 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 -- .../client/infrastructure/Serializer.kt | 23 -- .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 38 -- .../openapitools/client/models/Category.kt | 35 -- .../org/openapitools/client/models/Order.kt | 58 --- .../org/openapitools/client/models/Pet.kt | 60 --- .../org/openapitools/client/models/Tag.kt | 35 -- .../org/openapitools/client/models/User.kt | 54 --- .../org/openapitools/client/PetApiTest.kt | 104 ----- .../org/openapitools/client/apis/PetApi.kt | 374 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 198 --------- .../org/openapitools/client/apis/UserApi.kt | 363 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 -- .../client/infrastructure/ApiClient.kt | 251 ------------ .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 -- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 16 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 -- .../client/infrastructure/Serializer.kt | 23 -- .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 -- .../org/openapitools/client/models/Order.kt | 54 --- .../org/openapitools/client/models/Pet.kt | 56 --- .../org/openapitools/client/models/Tag.kt | 29 -- .../org/openapitools/client/models/User.kt | 48 --- .../org/openapitools/client/PetApiTest.kt | 104 ----- .../org/openapitools/client/apis/PetApi.kt | 278 ------------- .../org/openapitools/client/apis/StoreApi.kt | 146 ------- .../org/openapitools/client/apis/UserApi.kt | 271 ------------- .../client/infrastructure/ApiAbstractions.kt | 20 - .../client/infrastructure/ApiClient.kt | 141 ------- .../ApiInfrastructureResponse.kt | 40 -- .../infrastructure/ApplicationDelegates.kt | 29 -- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 42 -- .../client/infrastructure/RequestConfig.kt | 16 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 23 -- .../client/infrastructure/Serializer.kt | 14 - .../openapitools/client/models/ApiResponse.kt | 28 -- .../openapitools/client/models/Category.kt | 26 -- .../org/openapitools/client/models/Order.kt | 50 --- .../bin/org/openapitools/client/models/Pet.kt | 52 --- .../bin/org/openapitools/client/models/Tag.kt | 26 -- .../org/openapitools/client/models/User.kt | 39 -- 269 files changed, 19251 deletions(-) delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/Application.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuth.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthFlow.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuth.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthFlow.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/test/org/openapitools/client/PetApiTest.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/test/org/openapitools/client/PetApiTest.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin/bin/org/openapitools/client/models/User.kt diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index e4f7f4eeae0..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,374 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 08822c67e32..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,198 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 258a2540e9e..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,363 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 5d64a9add42..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.gson.toJson(content, T::class.java).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.gson.fromJson(bodyContent, T::class.java) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.gson.toJson(value, T::class.java).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index 6120b081929..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,33 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException - -class ByteArrayAdapter : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: ByteArray?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(String(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): ByteArray? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return out.nextString().toByteArray() - } - } - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt deleted file mode 100644 index c5d330ac075..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.text.DateFormat -import java.text.SimpleDateFormat -import java.util.Date -import java.util.Locale - -class DateAdapter(val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: Date?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): Date? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return formatter.parse(out.nextString()) - } - } - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index 30ef6697183..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: LocalDate?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): LocalDate? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return LocalDate.parse(out.nextString(), formatter) - } - } - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index 3ad781c66ca..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: LocalDateTime?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): LocalDateTime? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return LocalDateTime.parse(out.nextString(), formatter) - } - } - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index e615135c9cc..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: OffsetDateTime?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): OffsetDateTime? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return OffsetDateTime.parse(out.nextString(), formatter) - } - } - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 9c22257e223..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf() -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 6465f148553..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.Gson -import com.google.gson.GsonBuilder -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.OffsetDateTime -import java.util.UUID -import java.util.Date - -object Serializer { - @JvmStatic - val gsonBuilder: GsonBuilder = GsonBuilder() - .registerTypeAdapter(Date::class.java, DateAdapter()) - .registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter()) - .registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter()) - .registerTypeAdapter(LocalDate::class.java, LocalDateAdapter()) - .registerTypeAdapter(ByteArray::class.java, ByteArrayAdapter()) - - @JvmStatic - val gson: Gson by lazy { - gsonBuilder.create() - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index 54df813fcee..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @SerializedName("code") - val code: kotlin.Int? = null, - @SerializedName("type") - val type: kotlin.String? = null, - @SerializedName("message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index fdefa74fda0..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index 049c89df313..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("petId") - val petId: kotlin.Long? = null, - @SerializedName("quantity") - val quantity: kotlin.Int? = null, - @SerializedName("shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @SerializedName("status") - val status: Order.Status? = null, - @SerializedName("complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @SerializedName(value = "placed") placed("placed"), - @SerializedName(value = "approved") approved("approved"), - @SerializedName(value = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index af29ef2b61b..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.google.gson.annotations.SerializedName - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @SerializedName("name") - val name: kotlin.String, - @SerializedName("photoUrls") - val photoUrls: kotlin.collections.List, - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("category") - val category: Category? = null, - @SerializedName("tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @SerializedName("status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @SerializedName(value = "available") available("available"), - @SerializedName(value = "pending") pending("pending"), - @SerializedName(value = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 28e82b1df68..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index 62baf33e927..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("username") - val username: kotlin.String? = null, - @SerializedName("firstName") - val firstName: kotlin.String? = null, - @SerializedName("lastName") - val lastName: kotlin.String? = null, - @SerializedName("email") - val email: kotlin.String? = null, - @SerializedName("password") - val password: kotlin.String? = null, - @SerializedName("phone") - val phone: kotlin.String? = null, - /* User Status */ - @SerializedName("userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/Application.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/Application.kt deleted file mode 100644 index a48b80eecd4..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/Application.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapitools - -import org.openapitools.client.apis.PetApi -import org.openapitools.client.apis.StoreApi -import org.openapitools.client.models.Category -import org.openapitools.client.models.Pet -import org.openapitools.client.models.Tag - -fun main() { - println(".main") - val inventory = StoreApi().getInventory() - println("Inventory : $inventory") - val pet = Pet(name = "Elliot", photoUrls = listOf("https://jameshooverstudios.com/wp-content/uploads/2015/04/Majestic-Dog-Photography-Elliot-Nov-5-2014.jpg", "https://express-images.franklymedia.com/6616/sites/981/2020/01/22105725/Elliott.jpg"), id = 123456453, category = Category(id = 13259476, name = "dog"), tags = listOf(Tag(id = 194093, name = "Elliot")), status = Pet.Status.AVAILABLE) - PetApi().addPet(pet) - val elliot = PetApi().getPetById(123456453) - println("Elliot : $elliot") - assert(pet == elliot) - println(".main") - -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index e4f7f4eeae0..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,374 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 08822c67e32..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,198 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 258a2540e9e..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,363 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 2c15d73b189..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.jacksonObjectMapper.writeValueAsString(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.jacksonObjectMapper.readValue(bodyContent, T::class.java) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.jacksonObjectMapper.writeValueAsString(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index fff39c7ac24..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,3 +0,0 @@ -package org.openapitools.client.infrastructure - - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 9c22257e223..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf() -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 8b34e629c4e..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.SerializationFeature -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule -import com.fasterxml.jackson.annotation.JsonInclude -import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper -import java.util.Date - -object Serializer { - @JvmStatic - val jacksonObjectMapper: ObjectMapper = jacksonObjectMapper() - .registerModule(Jdk8Module()) - .registerModule(JavaTimeModule()) - .setSerializationInclusion(JsonInclude.Include.NON_ABSENT) - .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index c341f8ca321..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @field:JsonProperty("code") - val code: kotlin.Int? = null, - @field:JsonProperty("type") - val type: kotlin.String? = null, - @field:JsonProperty("message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index 2ed5390c1f3..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @field:JsonProperty("id") - val id: kotlin.Long? = null, - @field:JsonProperty("name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index c7df5b55614..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @field:JsonProperty("id") - val id: kotlin.Long? = null, - @field:JsonProperty("petId") - val petId: kotlin.Long? = null, - @field:JsonProperty("quantity") - val quantity: kotlin.Int? = null, - @field:JsonProperty("shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @field:JsonProperty("status") - val status: Order.Status? = null, - @field:JsonProperty("complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: PLACED,APPROVED,DELIVERED - */ - - enum class Status(val value: kotlin.String){ - @JsonProperty(value = "placed") PLACED("placed"), - @JsonProperty(value = "approved") APPROVED("approved"), - @JsonProperty(value = "delivered") DELIVERED("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index be5b168e2d8..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @field:JsonProperty("name") - val name: kotlin.String, - @field:JsonProperty("photoUrls") - val photoUrls: kotlin.collections.List, - @field:JsonProperty("id") - val id: kotlin.Long? = null, - @field:JsonProperty("category") - val category: Category? = null, - @field:JsonProperty("tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @field:JsonProperty("status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: AVAILABLE,PENDING,SOLD - */ - - enum class Status(val value: kotlin.String){ - @JsonProperty(value = "available") AVAILABLE("available"), - @JsonProperty(value = "pending") PENDING("pending"), - @JsonProperty(value = "sold") SOLD("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 7243f42ed7d..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @field:JsonProperty("id") - val id: kotlin.Long? = null, - @field:JsonProperty("name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index e8f639e5092..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @field:JsonProperty("id") - val id: kotlin.Long? = null, - @field:JsonProperty("username") - val username: kotlin.String? = null, - @field:JsonProperty("firstName") - val firstName: kotlin.String? = null, - @field:JsonProperty("lastName") - val lastName: kotlin.String? = null, - @field:JsonProperty("email") - val email: kotlin.String? = null, - @field:JsonProperty("password") - val password: kotlin.String? = null, - @field:JsonProperty("phone") - val phone: kotlin.String? = null, - /* User Status */ - @field:JsonProperty("userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index 6685f0a73d4..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,376 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Get all pets - * - * @param lastUpdated When this endpoint was hit last to help indentify if the client already has the latest copy. (optional) - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAllPets(lastUpdated: java.time.OffsetDateTime?) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - if (lastUpdated != null) { - put("lastUpdated", listOf(parseDateToQueryString(lastUpdated))) - } - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/getAll", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 08822c67e32..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,198 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 258a2540e9e..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,363 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index a69de1961da..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,245 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - return value.toString() - } -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 9c22257e223..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf() -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 697559b2ec1..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index fafca8738f6..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index a4c17c3b49d..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index a66c335904e..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index a3df06cb6eb..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 6e619023a5c..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index af1e270325d..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index e4f7f4eeae0..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,374 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 08822c67e32..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,198 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 258a2540e9e..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,363 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index e7f366d02cd..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 9c22257e223..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf() -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 06d9fe0bdc8..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index 18d2ce3dbbe..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ -@JsonClass(generateAdapter = true) -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index 8396fa42357..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,30 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * A category for a pet - * @param id - * @param name - */ -@JsonClass(generateAdapter = true) -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index d7091dd4c0c..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,55 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ -@JsonClass(generateAdapter = true) -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index 8b4e6b44d4c..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,57 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ -@JsonClass(generateAdapter = true) -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index e7cdab2bb5d..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,30 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * A tag for a pet - * @param id - * @param name - */ -@JsonClass(generateAdapter = true) -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index 1bfad844904..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,49 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ -@JsonClass(generateAdapter = true) -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index 69cb6b35ef2..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,374 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 4f8898adf9b..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,198 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 725b36b0106..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,363 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index d26cda9091c..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -internal typealias MultiValueMap = MutableMap> - -internal fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -internal val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -internal fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -internal fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 473b3fd42ce..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -internal open class ApiClient(val baseUrl: String) { - internal companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index c618544573e..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -internal enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -internal interface Response - -internal abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -internal class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -internal class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -internal class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -internal class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -internal class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index d7f9079c0d5..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -internal object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index 86bcb51fba6..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -internal class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index 204b69dcb08..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -internal open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - internal companion object { - private const val serialVersionUID: Long = 123L - } -} - -internal open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - internal companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index e86215d5717..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -internal class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index fe7069904ca..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -internal class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index be7703c103d..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -internal class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 3e87d2c30f9..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -internal data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf() -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index e0fbb1e6526..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -internal enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 858d1b7339b..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -internal val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -internal val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -internal val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -internal val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 371e2a7013e..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -internal object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index 02fa692b57d..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -internal class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index a695278dfa3..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -internal data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index 376994a9b25..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -internal data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index a943b97c1ea..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -internal data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - internal enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index 544fab20f5a..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -internal data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - internal enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index d9b84e93eaf..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -internal data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index e0e821cd7e3..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -internal data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index ef80c520fd2..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,374 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List? { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List? { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet? { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse? { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index b9dd7b38f59..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,198 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map? { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order? { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order? { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 2ae5998489d..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,363 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User? { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String? { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index e7f366d02cd..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 77066de4e55..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T?, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 9c22257e223..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf() -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 697559b2ec1..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index 7d40c8efbc2..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,38 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index ceb0fbc8fe6..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index ed8f8b13a43..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,58 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index 105f485f021..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,60 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 944b1cd0a14..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index 9697f07d5bf..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index e4f7f4eeae0..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,374 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 08822c67e32..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,198 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 258a2540e9e..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,363 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index f60e40309bc..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,249 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.MediaType -import okhttp3.FormBody -import okhttp3.HttpUrl -import okhttp3.ResponseBody -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> RequestBody.create( - MediaType.parse(mediaType), content - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.of( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = MediaType.parse(guessContentTypeFromFile(value)) - addPart(partHeaders, RequestBody.create(fileMediaType, value)) - } else { - val partHeaders = Headers.of( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - RequestBody.create(null, parameterToString(value)) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> RequestBody.create( - MediaType.parse(mediaType), Serializer.moshi.adapter(T::class.java).toJson(content) - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { - val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code(), - response.headers().toMultimap() - ) - response.isInformational -> return Informational( - response.message(), - response.code(), - response.headers().toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body(), accept), - response.code(), - response.headers().toMultimap() - ) - response.isClientError -> return ClientError( - response.message(), - response.body()?.string(), - response.code(), - response.headers().toMultimap() - ) - else -> return ServerError( - response.message(), - response.body()?.string(), - response.code(), - response.headers().toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 9c22257e223..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf() -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 037fedbd18b..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code() in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code() in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code() in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code() in 500..999 diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 697559b2ec1..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index fafca8738f6..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index a4c17c3b49d..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index a66c335904e..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index a3df06cb6eb..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 6e619023a5c..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index af1e270325d..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index b52cebf4c31..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,125 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import okhttp3.RequestBody -import io.reactivex.rxjava3.core.Single; -import io.reactivex.rxjava3.core.Completable; - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import okhttp3.MultipartBody - -interface PetApi { - /** - * Add a new pet to the store - * - * Responses: - * - 405: Invalid input - * - * @param body Pet object that needs to be added to the store - * @return [Call]<[Unit]> - */ - @POST("pet") - fun addPet(@Body body: Pet): Completable - - /** - * Deletes a pet - * - * Responses: - * - 400: Invalid pet value - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return [Call]<[Unit]> - */ - @DELETE("pet/{petId}") - fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Completable - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * Responses: - * - 200: successful operation - * - 400: Invalid status value - * - * @param status Status values that need to be considered for filter - * @return [Call]<[kotlin.collections.List]> - */ - @GET("pet/findByStatus") - fun findPetsByStatus(@Query("status") status: CSVParams): Single> - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Responses: - * - 200: successful operation - * - 400: Invalid tag value - * - * @param tags Tags to filter by - * @return [Call]<[kotlin.collections.List]> - */ - @Deprecated("This api was deprecated") - @GET("pet/findByTags") - fun findPetsByTags(@Query("tags") tags: CSVParams): Single> - - /** - * Find pet by ID - * Returns a single pet - * Responses: - * - 200: successful operation - * - 400: Invalid ID supplied - * - 404: Pet not found - * - * @param petId ID of pet to return - * @return [Call]<[Pet]> - */ - @GET("pet/{petId}") - fun getPetById(@Path("petId") petId: kotlin.Long): Single - - /** - * Update an existing pet - * - * Responses: - * - 400: Invalid ID supplied - * - 404: Pet not found - * - 405: Validation exception - * - * @param body Pet object that needs to be added to the store - * @return [Call]<[Unit]> - */ - @PUT("pet") - fun updatePet(@Body body: Pet): Completable - - /** - * Updates a pet in the store with form data - * - * Responses: - * - 405: Invalid input - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return [Call]<[Unit]> - */ - @FormUrlEncoded - @POST("pet/{petId}") - fun updatePetWithForm(@Path("petId") petId: kotlin.Long, @Field("name") name: kotlin.String, @Field("status") status: kotlin.String): Completable - - /** - * uploads an image - * - * Responses: - * - 200: successful operation - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return [Call]<[ApiResponse]> - */ - @Multipart - @POST("pet/{petId}/uploadImage") - fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String, @Part file: MultipartBody.Part): Single - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 96603a0729a..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import okhttp3.RequestBody -import io.reactivex.rxjava3.core.Single; -import io.reactivex.rxjava3.core.Completable; - -import org.openapitools.client.models.Order - -interface StoreApi { - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Responses: - * - 400: Invalid ID supplied - * - 404: Order not found - * - * @param orderId ID of the order that needs to be deleted - * @return [Call]<[Unit]> - */ - @DELETE("store/order/{orderId}") - fun deleteOrder(@Path("orderId") orderId: kotlin.String): Completable - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * Responses: - * - 200: successful operation - * - * @return [Call]<[kotlin.collections.Map]> - */ - @GET("store/inventory") - fun getInventory(): Single> - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * Responses: - * - 200: successful operation - * - 400: Invalid ID supplied - * - 404: Order not found - * - * @param orderId ID of pet that needs to be fetched - * @return [Call]<[Order]> - */ - @GET("store/order/{orderId}") - fun getOrderById(@Path("orderId") orderId: kotlin.Long): Single - - /** - * Place an order for a pet - * - * Responses: - * - 200: successful operation - * - 400: Invalid Order - * - * @param body order placed for purchasing the pet - * @return [Call]<[Order]> - */ - @POST("store/order") - fun placeOrder(@Body body: Order): Single - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 4e04bc3627e..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,114 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import okhttp3.RequestBody -import io.reactivex.rxjava3.core.Single; -import io.reactivex.rxjava3.core.Completable; - -import org.openapitools.client.models.User - -interface UserApi { - /** - * Create user - * This can only be done by the logged in user. - * Responses: - * - 0: successful operation - * - * @param body Created user object - * @return [Call]<[Unit]> - */ - @POST("user") - fun createUser(@Body body: User): Completable - - /** - * Creates list of users with given input array - * - * Responses: - * - 0: successful operation - * - * @param body List of user object - * @return [Call]<[Unit]> - */ - @POST("user/createWithArray") - fun createUsersWithArrayInput(@Body body: kotlin.collections.List): Completable - - /** - * Creates list of users with given input array - * - * Responses: - * - 0: successful operation - * - * @param body List of user object - * @return [Call]<[Unit]> - */ - @POST("user/createWithList") - fun createUsersWithListInput(@Body body: kotlin.collections.List): Completable - - /** - * Delete user - * This can only be done by the logged in user. - * Responses: - * - 400: Invalid username supplied - * - 404: User not found - * - * @param username The name that needs to be deleted - * @return [Call]<[Unit]> - */ - @DELETE("user/{username}") - fun deleteUser(@Path("username") username: kotlin.String): Completable - - /** - * Get user by user name - * - * Responses: - * - 200: successful operation - * - 400: Invalid username supplied - * - 404: User not found - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return [Call]<[User]> - */ - @GET("user/{username}") - fun getUserByName(@Path("username") username: kotlin.String): Single - - /** - * Logs user into the system - * - * Responses: - * - 200: successful operation - * - 400: Invalid username/password supplied - * - * @param username The user name for login - * @param password The password for login in clear text - * @return [Call]<[kotlin.String]> - */ - @GET("user/login") - fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Single - - /** - * Logs out current logged in user session - * - * Responses: - * - 0: successful operation - * - * @return [Call]<[Unit]> - */ - @GET("user/logout") - fun logoutUser(): Completable - - /** - * Updated user - * This can only be done by the logged in user. - * Responses: - * - 400: Invalid user supplied - * - 404: User not found - * - * @param username name that need to be deleted - * @param body Updated user object - * @return [Call]<[Unit]> - */ - @PUT("user/{username}") - fun updateUser(@Path("username") username: kotlin.String, @Body body: User): Completable - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt deleted file mode 100644 index 524d5190ef8..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt +++ /dev/null @@ -1,50 +0,0 @@ -package org.openapitools.client.auth - -import java.io.IOException -import java.net.URI -import java.net.URISyntaxException - -import okhttp3.Interceptor -import okhttp3.Response - -class ApiKeyAuth( - private val location: String = "", - private val paramName: String = "", - private var apiKey: String = "" -) : Interceptor { - - @Throws(IOException::class) - override fun intercept(chain: Interceptor.Chain): Response { - var request = chain.request() - - if ("query" == location) { - var newQuery = request.url.toUri().query - val paramValue = "$paramName=$apiKey" - if (newQuery == null) { - newQuery = paramValue - } else { - newQuery += "&$paramValue" - } - - val newUri: URI - try { - val oldUri = request.url.toUri() - newUri = URI(oldUri.scheme, oldUri.authority, - oldUri.path, newQuery, oldUri.fragment) - } catch (e: URISyntaxException) { - throw IOException(e) - } - - request = request.newBuilder().url(newUri.toURL()).build() - } else if ("header" == location) { - request = request.newBuilder() - .addHeader(paramName, apiKey) - .build() - } else if ("cookie" == location) { - request = request.newBuilder() - .addHeader("Cookie", "$paramName=$apiKey") - .build() - } - return chain.proceed(request) - } -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuth.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuth.kt deleted file mode 100644 index 311a8f43979..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuth.kt +++ /dev/null @@ -1,151 +0,0 @@ -package org.openapitools.client.auth - -import java.net.HttpURLConnection.HTTP_UNAUTHORIZED -import java.net.HttpURLConnection.HTTP_FORBIDDEN - -import java.io.IOException - -import org.apache.oltu.oauth2.client.OAuthClient -import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest -import org.apache.oltu.oauth2.client.request.OAuthClientRequest -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder -import org.apache.oltu.oauth2.common.exception.OAuthProblemException -import org.apache.oltu.oauth2.common.exception.OAuthSystemException -import org.apache.oltu.oauth2.common.message.types.GrantType -import org.apache.oltu.oauth2.common.token.BasicOAuthToken - -import okhttp3.Interceptor -import okhttp3.OkHttpClient -import okhttp3.Response - -class OAuth( - client: OkHttpClient, - var tokenRequestBuilder: TokenRequestBuilder -) : Interceptor { - - interface AccessTokenListener { - fun notify(token: BasicOAuthToken) - } - - private var oauthClient: OAuthClient = OAuthClient(OAuthOkHttpClient(client)) - - @Volatile - private var accessToken: String? = null - var authenticationRequestBuilder: AuthenticationRequestBuilder? = null - private var accessTokenListener: AccessTokenListener? = null - - constructor( - requestBuilder: TokenRequestBuilder - ) : this( - OkHttpClient(), - requestBuilder - ) - - constructor( - flow: OAuthFlow, - authorizationUrl: String, - tokenUrl: String, - scopes: String - ) : this( - OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes) - ) { - setFlow(flow); - authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl); - } - - fun setFlow(flow: OAuthFlow) { - when (flow) { - OAuthFlow.accessCode, OAuthFlow.implicit -> - tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE) - OAuthFlow.password -> - tokenRequestBuilder.setGrantType(GrantType.PASSWORD) - OAuthFlow.application -> - tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS) - } - } - - @Throws(IOException::class) - override fun intercept(chain: Interceptor.Chain): Response { - return retryingIntercept(chain, true) - } - - @Throws(IOException::class) - private fun retryingIntercept(chain: Interceptor.Chain, updateTokenAndRetryOnAuthorizationFailure: Boolean): Response { - var request = chain.request() - - // If the request already have an authorization (eg. Basic auth), do nothing - if (request.header("Authorization") != null) { - return chain.proceed(request) - } - - // If first time, get the token - val oAuthRequest: OAuthClientRequest - if (accessToken == null) { - updateAccessToken(null) - } - - if (accessToken != null) { - // Build the request - val rb = request.newBuilder() - - val requestAccessToken = accessToken - try { - oAuthRequest = OAuthBearerClientRequest(request.url.toString()) - .setAccessToken(requestAccessToken) - .buildHeaderMessage() - } catch (e: OAuthSystemException) { - throw IOException(e) - } - - oAuthRequest.headers.entries.forEach { header -> - rb.addHeader(header.key, header.value) - } - rb.url(oAuthRequest.locationUri) - - //Execute the request - val response = chain.proceed(rb.build()) - - // 401/403 most likely indicates that access token has expired. Unless it happens two times in a row. - if ((response.code == HTTP_UNAUTHORIZED || response.code == HTTP_FORBIDDEN) && updateTokenAndRetryOnAuthorizationFailure) { - try { - if (updateAccessToken(requestAccessToken)) { - response.body?.close() - return retryingIntercept(chain, false) - } - } catch (e: Exception) { - response.body?.close() - throw e - } - } - return response - } else { - return chain.proceed(chain.request()) - } - } - - /** - * Returns true if the access token has been updated - */ - @Throws(IOException::class) - @Synchronized - fun updateAccessToken(requestAccessToken: String?): Boolean { - if (accessToken == null || accessToken.equals(requestAccessToken)) { - return try { - val accessTokenResponse = oauthClient.accessToken(this.tokenRequestBuilder.buildBodyMessage()) - if (accessTokenResponse != null && accessTokenResponse.accessToken != null) { - accessToken = accessTokenResponse.accessToken - accessTokenListener?.notify(accessTokenResponse.oAuthToken as BasicOAuthToken) - !accessToken.equals(requestAccessToken) - } else { - false - } - } catch (e: OAuthSystemException) { - throw IOException(e) - } catch (e: OAuthProblemException) { - throw IOException(e) - } - } - return true; - } -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthFlow.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthFlow.kt deleted file mode 100644 index bcada9b7a6a..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthFlow.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapitools.client.auth - -enum class OAuthFlow { - accessCode, implicit, password, application -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt deleted file mode 100644 index 93adbda3fc9..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt +++ /dev/null @@ -1,61 +0,0 @@ -package org.openapitools.client.auth - -import java.io.IOException - -import org.apache.oltu.oauth2.client.HttpClient -import org.apache.oltu.oauth2.client.request.OAuthClientRequest -import org.apache.oltu.oauth2.client.response.OAuthClientResponse -import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory -import org.apache.oltu.oauth2.common.exception.OAuthProblemException -import org.apache.oltu.oauth2.common.exception.OAuthSystemException - -import okhttp3.OkHttpClient -import okhttp3.Request -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.RequestBody - - -class OAuthOkHttpClient( - private var client: OkHttpClient -) : HttpClient { - - constructor() : this(OkHttpClient()) - - @Throws(OAuthSystemException::class, OAuthProblemException::class) - override fun execute( - request: OAuthClientRequest, - headers: Map?, - requestMethod: String, - responseClass: Class?): T { - - var mediaType = "application/json".toMediaTypeOrNull() - val requestBuilder = Request.Builder().url(request.locationUri) - - headers?.forEach { entry -> - if (entry.key.equals("Content-Type", true)) { - mediaType = entry.value.toMediaTypeOrNull() - } else { - requestBuilder.addHeader(entry.key, entry.value) - } - } - - val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null - requestBuilder.method(requestMethod, body) - - try { - val response = client.newCall(requestBuilder.build()).execute() - return OAuthClientResponseFactory.createCustomResponse( - response.body?.string(), - response.body?.contentType()?.toString(), - response.code, - responseClass) - } catch (e: IOException) { - throw OAuthSystemException(e) - } - } - - override fun shutdown() { - // Nothing to do here - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index e3962e0c0f2..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,204 +0,0 @@ -package org.openapitools.client.infrastructure - -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder -import org.openapitools.client.auth.ApiKeyAuth -import org.openapitools.client.auth.OAuth -import org.openapitools.client.auth.OAuth.AccessTokenListener -import org.openapitools.client.auth.OAuthFlow - -import okhttp3.Interceptor -import okhttp3.OkHttpClient -import retrofit2.Retrofit -import okhttp3.logging.HttpLoggingInterceptor -import retrofit2.converter.scalars.ScalarsConverterFactory -import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory -import com.squareup.moshi.Moshi -import retrofit2.converter.moshi.MoshiConverterFactory - -class ApiClient( - private var baseUrl: String = defaultBasePath, - private val okHttpClientBuilder: OkHttpClient.Builder? = null, - private val serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - private val okHttpClient : OkHttpClient? = null -) { - private val apiAuthorizations = mutableMapOf() - var logger: ((String) -> Unit)? = null - - private val retrofitBuilder: Retrofit.Builder by lazy { - Retrofit.Builder() - .baseUrl(baseUrl) - .addConverterFactory(ScalarsConverterFactory.create()) - - .addCallAdapterFactory(RxJava3CallAdapterFactory.create()) - .addConverterFactory(MoshiConverterFactory.create(serializerBuilder.build())) - } - - private val clientBuilder: OkHttpClient.Builder by lazy { - okHttpClientBuilder ?: defaultClientBuilder - } - - private val defaultClientBuilder: OkHttpClient.Builder by lazy { - OkHttpClient() - .newBuilder() - .addInterceptor(HttpLoggingInterceptor(object : HttpLoggingInterceptor.Logger { - override fun log(message: String) { - logger?.invoke(message) - } - }).apply { - level = HttpLoggingInterceptor.Level.BODY - }) - } - - init { - normalizeBaseUrl() - } - - constructor( - baseUrl: String = defaultBasePath, - okHttpClientBuilder: OkHttpClient.Builder? = null, - serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - authNames: Array - ) : this(baseUrl, okHttpClientBuilder, serializerBuilder) { - authNames.forEach { authName -> - val auth = when (authName) { - "api_key" -> ApiKeyAuth("header", "api_key")"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets") - else -> throw RuntimeException("auth name $authName not found in available auth names") - } - addAuthorization(authName, auth); - } - } - - constructor( - baseUrl: String = defaultBasePath, - okHttpClientBuilder: OkHttpClient.Builder? = null, - serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - authName: String, - clientId: String, - secret: String, - username: String, - password: String - ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { - getTokenEndPoint() - ?.setClientId(clientId) - ?.setClientSecret(secret) - ?.setUsername(username) - ?.setPassword(password) - } - - /** - * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Token request builder - */ - fun getTokenEndPoint(): TokenRequestBuilder? { - var result: TokenRequestBuilder? = null - apiAuthorizations.values.runOnFirst { - result = tokenRequestBuilder - } - return result - } - - /** - * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Authentication request builder - */ - fun getAuthorizationEndPoint(): AuthenticationRequestBuilder? { - var result: AuthenticationRequestBuilder? = null - apiAuthorizations.values.runOnFirst { - result = authenticationRequestBuilder - } - return result - } - - /** - * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one) - * @param accessToken Access token - * @return ApiClient - */ - fun setAccessToken(accessToken: String): ApiClient { - apiAuthorizations.values.runOnFirst { - setAccessToken(accessToken) - } - return this - } - - /** - * Helper method to configure the oauth accessCode/implicit flow parameters - * @param clientId Client ID - * @param clientSecret Client secret - * @param redirectURI Redirect URI - * @return ApiClient - */ - fun configureAuthorizationFlow(clientId: String, clientSecret: String, redirectURI: String): ApiClient { - apiAuthorizations.values.runOnFirst { - tokenRequestBuilder - .setClientId(clientId) - .setClientSecret(clientSecret) - .setRedirectURI(redirectURI) - authenticationRequestBuilder - ?.setClientId(clientId) - ?.setRedirectURI(redirectURI) - } - return this; - } - - /** - * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener Access token listener - * @return ApiClient - */ - fun registerAccessTokenListener(accessTokenListener: AccessTokenListener): ApiClient { - apiAuthorizations.values.runOnFirst { - registerAccessTokenListener(accessTokenListener) - } - return this; - } - - /** - * Adds an authorization to be used by the client - * @param authName Authentication name - * @param authorization Authorization interceptor - * @return ApiClient - */ - fun addAuthorization(authName: String, authorization: Interceptor): ApiClient { - if (apiAuthorizations.containsKey(authName)) { - throw RuntimeException("auth name $authName already in api authorizations") - } - apiAuthorizations[authName] = authorization - clientBuilder.addInterceptor(authorization) - return this - } - - fun setLogger(logger: (String) -> Unit): ApiClient { - this.logger = logger - return this - } - - fun createService(serviceClass: Class): S { - var usedClient: OkHttpClient? = null - this.okHttpClient?.let { usedClient = it } ?: run {usedClient = clientBuilder.build()} - return retrofitBuilder.client(usedClient).build().create(serviceClass) - } - - private fun normalizeBaseUrl() { - if (!baseUrl.endsWith("/")) { - baseUrl += "/" - } - } - - private inline fun Iterable.runOnFirst(callback: U.() -> Unit) { - for (element in this) { - if (element is U) { - callback.invoke(element) - break - } - } - } - - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt deleted file mode 100644 index 001e99325d2..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt +++ /dev/null @@ -1,56 +0,0 @@ -package org.openapitools.client.infrastructure - -class CollectionFormats { - - open class CSVParams { - - var params: List - - constructor(params: List) { - this.params = params - } - - constructor(vararg params: String) { - this.params = listOf(*params) - } - - override fun toString(): String { - return params.joinToString(",") - } - } - - open class SSVParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString(" ") - } - } - - class TSVParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString("\t") - } - } - - class PIPESParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString("|") - } - } - - class SPACEParams : SSVParams() -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt deleted file mode 100644 index 1804d1ae2bb..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.JsonDataException -import com.squareup.moshi.Moshi -import retrofit2.Response - -@Throws(JsonDataException::class) -inline fun Response<*>.getErrorResponse(serializerBuilder: Moshi.Builder = Serializer.moshiBuilder): T? { - val serializer = serializerBuilder.build() - val parser = serializer.adapter(T::class.java) - val response = errorBody()?.string() - if(response != null) { - return parser.fromJson(response) - } - return null -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 697559b2ec1..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index fafca8738f6..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index a4c17c3b49d..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index a66c335904e..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index a3df06cb6eb..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 6e619023a5c..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index af1e270325d..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index 4d78248129c..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import retrofit2.Call -import okhttp3.RequestBody - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import okhttp3.MultipartBody - -interface PetApi { - /** - * Add a new pet to the store - * - * Responses: - * - 405: Invalid input - * - * @param body Pet object that needs to be added to the store - * @return [Call]<[Unit]> - */ - @POST("pet") - fun addPet(@Body body: Pet): Call - - /** - * Deletes a pet - * - * Responses: - * - 400: Invalid pet value - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return [Call]<[Unit]> - */ - @DELETE("pet/{petId}") - fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Call - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * Responses: - * - 200: successful operation - * - 400: Invalid status value - * - * @param status Status values that need to be considered for filter - * @return [Call]<[kotlin.collections.List]> - */ - @GET("pet/findByStatus") - fun findPetsByStatus(@Query("status") status: CSVParams): Call> - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Responses: - * - 200: successful operation - * - 400: Invalid tag value - * - * @param tags Tags to filter by - * @return [Call]<[kotlin.collections.List]> - */ - @Deprecated("This api was deprecated") - @GET("pet/findByTags") - fun findPetsByTags(@Query("tags") tags: CSVParams): Call> - - /** - * Find pet by ID - * Returns a single pet - * Responses: - * - 200: successful operation - * - 400: Invalid ID supplied - * - 404: Pet not found - * - * @param petId ID of pet to return - * @return [Call]<[Pet]> - */ - @GET("pet/{petId}") - fun getPetById(@Path("petId") petId: kotlin.Long): Call - - /** - * Update an existing pet - * - * Responses: - * - 400: Invalid ID supplied - * - 404: Pet not found - * - 405: Validation exception - * - * @param body Pet object that needs to be added to the store - * @return [Call]<[Unit]> - */ - @PUT("pet") - fun updatePet(@Body body: Pet): Call - - /** - * Updates a pet in the store with form data - * - * Responses: - * - 405: Invalid input - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return [Call]<[Unit]> - */ - @FormUrlEncoded - @POST("pet/{petId}") - fun updatePetWithForm(@Path("petId") petId: kotlin.Long, @Field("name") name: kotlin.String, @Field("status") status: kotlin.String): Call - - /** - * uploads an image - * - * Responses: - * - 200: successful operation - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return [Call]<[ApiResponse]> - */ - @Multipart - @POST("pet/{petId}/uploadImage") - fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String, @Part file: MultipartBody.Part): Call - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 45b6d20b1c7..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,62 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import retrofit2.Call -import okhttp3.RequestBody - -import org.openapitools.client.models.Order - -interface StoreApi { - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Responses: - * - 400: Invalid ID supplied - * - 404: Order not found - * - * @param orderId ID of the order that needs to be deleted - * @return [Call]<[Unit]> - */ - @DELETE("store/order/{orderId}") - fun deleteOrder(@Path("orderId") orderId: kotlin.String): Call - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * Responses: - * - 200: successful operation - * - * @return [Call]<[kotlin.collections.Map]> - */ - @GET("store/inventory") - fun getInventory(): Call> - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * Responses: - * - 200: successful operation - * - 400: Invalid ID supplied - * - 404: Order not found - * - * @param orderId ID of pet that needs to be fetched - * @return [Call]<[Order]> - */ - @GET("store/order/{orderId}") - fun getOrderById(@Path("orderId") orderId: kotlin.Long): Call - - /** - * Place an order for a pet - * - * Responses: - * - 200: successful operation - * - 400: Invalid Order - * - * @param body order placed for purchasing the pet - * @return [Call]<[Order]> - */ - @POST("store/order") - fun placeOrder(@Body body: Order): Call - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 33f031ec714..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,113 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import retrofit2.Call -import okhttp3.RequestBody - -import org.openapitools.client.models.User - -interface UserApi { - /** - * Create user - * This can only be done by the logged in user. - * Responses: - * - 0: successful operation - * - * @param body Created user object - * @return [Call]<[Unit]> - */ - @POST("user") - fun createUser(@Body body: User): Call - - /** - * Creates list of users with given input array - * - * Responses: - * - 0: successful operation - * - * @param body List of user object - * @return [Call]<[Unit]> - */ - @POST("user/createWithArray") - fun createUsersWithArrayInput(@Body body: kotlin.collections.List): Call - - /** - * Creates list of users with given input array - * - * Responses: - * - 0: successful operation - * - * @param body List of user object - * @return [Call]<[Unit]> - */ - @POST("user/createWithList") - fun createUsersWithListInput(@Body body: kotlin.collections.List): Call - - /** - * Delete user - * This can only be done by the logged in user. - * Responses: - * - 400: Invalid username supplied - * - 404: User not found - * - * @param username The name that needs to be deleted - * @return [Call]<[Unit]> - */ - @DELETE("user/{username}") - fun deleteUser(@Path("username") username: kotlin.String): Call - - /** - * Get user by user name - * - * Responses: - * - 200: successful operation - * - 400: Invalid username supplied - * - 404: User not found - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return [Call]<[User]> - */ - @GET("user/{username}") - fun getUserByName(@Path("username") username: kotlin.String): Call - - /** - * Logs user into the system - * - * Responses: - * - 200: successful operation - * - 400: Invalid username/password supplied - * - * @param username The user name for login - * @param password The password for login in clear text - * @return [Call]<[kotlin.String]> - */ - @GET("user/login") - fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Call - - /** - * Logs out current logged in user session - * - * Responses: - * - 0: successful operation - * - * @return [Call]<[Unit]> - */ - @GET("user/logout") - fun logoutUser(): Call - - /** - * Updated user - * This can only be done by the logged in user. - * Responses: - * - 400: Invalid user supplied - * - 404: User not found - * - * @param username name that need to be deleted - * @param body Updated user object - * @return [Call]<[Unit]> - */ - @PUT("user/{username}") - fun updateUser(@Path("username") username: kotlin.String, @Body body: User): Call - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt deleted file mode 100644 index 524d5190ef8..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt +++ /dev/null @@ -1,50 +0,0 @@ -package org.openapitools.client.auth - -import java.io.IOException -import java.net.URI -import java.net.URISyntaxException - -import okhttp3.Interceptor -import okhttp3.Response - -class ApiKeyAuth( - private val location: String = "", - private val paramName: String = "", - private var apiKey: String = "" -) : Interceptor { - - @Throws(IOException::class) - override fun intercept(chain: Interceptor.Chain): Response { - var request = chain.request() - - if ("query" == location) { - var newQuery = request.url.toUri().query - val paramValue = "$paramName=$apiKey" - if (newQuery == null) { - newQuery = paramValue - } else { - newQuery += "&$paramValue" - } - - val newUri: URI - try { - val oldUri = request.url.toUri() - newUri = URI(oldUri.scheme, oldUri.authority, - oldUri.path, newQuery, oldUri.fragment) - } catch (e: URISyntaxException) { - throw IOException(e) - } - - request = request.newBuilder().url(newUri.toURL()).build() - } else if ("header" == location) { - request = request.newBuilder() - .addHeader(paramName, apiKey) - .build() - } else if ("cookie" == location) { - request = request.newBuilder() - .addHeader("Cookie", "$paramName=$apiKey") - .build() - } - return chain.proceed(request) - } -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuth.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuth.kt deleted file mode 100644 index 311a8f43979..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuth.kt +++ /dev/null @@ -1,151 +0,0 @@ -package org.openapitools.client.auth - -import java.net.HttpURLConnection.HTTP_UNAUTHORIZED -import java.net.HttpURLConnection.HTTP_FORBIDDEN - -import java.io.IOException - -import org.apache.oltu.oauth2.client.OAuthClient -import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest -import org.apache.oltu.oauth2.client.request.OAuthClientRequest -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder -import org.apache.oltu.oauth2.common.exception.OAuthProblemException -import org.apache.oltu.oauth2.common.exception.OAuthSystemException -import org.apache.oltu.oauth2.common.message.types.GrantType -import org.apache.oltu.oauth2.common.token.BasicOAuthToken - -import okhttp3.Interceptor -import okhttp3.OkHttpClient -import okhttp3.Response - -class OAuth( - client: OkHttpClient, - var tokenRequestBuilder: TokenRequestBuilder -) : Interceptor { - - interface AccessTokenListener { - fun notify(token: BasicOAuthToken) - } - - private var oauthClient: OAuthClient = OAuthClient(OAuthOkHttpClient(client)) - - @Volatile - private var accessToken: String? = null - var authenticationRequestBuilder: AuthenticationRequestBuilder? = null - private var accessTokenListener: AccessTokenListener? = null - - constructor( - requestBuilder: TokenRequestBuilder - ) : this( - OkHttpClient(), - requestBuilder - ) - - constructor( - flow: OAuthFlow, - authorizationUrl: String, - tokenUrl: String, - scopes: String - ) : this( - OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes) - ) { - setFlow(flow); - authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl); - } - - fun setFlow(flow: OAuthFlow) { - when (flow) { - OAuthFlow.accessCode, OAuthFlow.implicit -> - tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE) - OAuthFlow.password -> - tokenRequestBuilder.setGrantType(GrantType.PASSWORD) - OAuthFlow.application -> - tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS) - } - } - - @Throws(IOException::class) - override fun intercept(chain: Interceptor.Chain): Response { - return retryingIntercept(chain, true) - } - - @Throws(IOException::class) - private fun retryingIntercept(chain: Interceptor.Chain, updateTokenAndRetryOnAuthorizationFailure: Boolean): Response { - var request = chain.request() - - // If the request already have an authorization (eg. Basic auth), do nothing - if (request.header("Authorization") != null) { - return chain.proceed(request) - } - - // If first time, get the token - val oAuthRequest: OAuthClientRequest - if (accessToken == null) { - updateAccessToken(null) - } - - if (accessToken != null) { - // Build the request - val rb = request.newBuilder() - - val requestAccessToken = accessToken - try { - oAuthRequest = OAuthBearerClientRequest(request.url.toString()) - .setAccessToken(requestAccessToken) - .buildHeaderMessage() - } catch (e: OAuthSystemException) { - throw IOException(e) - } - - oAuthRequest.headers.entries.forEach { header -> - rb.addHeader(header.key, header.value) - } - rb.url(oAuthRequest.locationUri) - - //Execute the request - val response = chain.proceed(rb.build()) - - // 401/403 most likely indicates that access token has expired. Unless it happens two times in a row. - if ((response.code == HTTP_UNAUTHORIZED || response.code == HTTP_FORBIDDEN) && updateTokenAndRetryOnAuthorizationFailure) { - try { - if (updateAccessToken(requestAccessToken)) { - response.body?.close() - return retryingIntercept(chain, false) - } - } catch (e: Exception) { - response.body?.close() - throw e - } - } - return response - } else { - return chain.proceed(chain.request()) - } - } - - /** - * Returns true if the access token has been updated - */ - @Throws(IOException::class) - @Synchronized - fun updateAccessToken(requestAccessToken: String?): Boolean { - if (accessToken == null || accessToken.equals(requestAccessToken)) { - return try { - val accessTokenResponse = oauthClient.accessToken(this.tokenRequestBuilder.buildBodyMessage()) - if (accessTokenResponse != null && accessTokenResponse.accessToken != null) { - accessToken = accessTokenResponse.accessToken - accessTokenListener?.notify(accessTokenResponse.oAuthToken as BasicOAuthToken) - !accessToken.equals(requestAccessToken) - } else { - false - } - } catch (e: OAuthSystemException) { - throw IOException(e) - } catch (e: OAuthProblemException) { - throw IOException(e) - } - } - return true; - } -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthFlow.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthFlow.kt deleted file mode 100644 index bcada9b7a6a..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthFlow.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapitools.client.auth - -enum class OAuthFlow { - accessCode, implicit, password, application -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt deleted file mode 100644 index 93adbda3fc9..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt +++ /dev/null @@ -1,61 +0,0 @@ -package org.openapitools.client.auth - -import java.io.IOException - -import org.apache.oltu.oauth2.client.HttpClient -import org.apache.oltu.oauth2.client.request.OAuthClientRequest -import org.apache.oltu.oauth2.client.response.OAuthClientResponse -import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory -import org.apache.oltu.oauth2.common.exception.OAuthProblemException -import org.apache.oltu.oauth2.common.exception.OAuthSystemException - -import okhttp3.OkHttpClient -import okhttp3.Request -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.RequestBody - - -class OAuthOkHttpClient( - private var client: OkHttpClient -) : HttpClient { - - constructor() : this(OkHttpClient()) - - @Throws(OAuthSystemException::class, OAuthProblemException::class) - override fun execute( - request: OAuthClientRequest, - headers: Map?, - requestMethod: String, - responseClass: Class?): T { - - var mediaType = "application/json".toMediaTypeOrNull() - val requestBuilder = Request.Builder().url(request.locationUri) - - headers?.forEach { entry -> - if (entry.key.equals("Content-Type", true)) { - mediaType = entry.value.toMediaTypeOrNull() - } else { - requestBuilder.addHeader(entry.key, entry.value) - } - } - - val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null - requestBuilder.method(requestMethod, body) - - try { - val response = client.newCall(requestBuilder.build()).execute() - return OAuthClientResponseFactory.createCustomResponse( - response.body?.string(), - response.body?.contentType()?.toString(), - response.code, - responseClass) - } catch (e: IOException) { - throw OAuthSystemException(e) - } - } - - override fun shutdown() { - // Nothing to do here - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 8f822585a6e..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,201 +0,0 @@ -package org.openapitools.client.infrastructure - -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder -import org.openapitools.client.auth.ApiKeyAuth -import org.openapitools.client.auth.OAuth -import org.openapitools.client.auth.OAuth.AccessTokenListener -import org.openapitools.client.auth.OAuthFlow - -import okhttp3.Interceptor -import okhttp3.OkHttpClient -import retrofit2.Retrofit -import okhttp3.logging.HttpLoggingInterceptor -import retrofit2.converter.scalars.ScalarsConverterFactory -import com.squareup.moshi.Moshi -import retrofit2.converter.moshi.MoshiConverterFactory - -class ApiClient( - private var baseUrl: String = defaultBasePath, - private val okHttpClientBuilder: OkHttpClient.Builder? = null, - private val serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - private val okHttpClient : OkHttpClient? = null -) { - private val apiAuthorizations = mutableMapOf() - var logger: ((String) -> Unit)? = null - - private val retrofitBuilder: Retrofit.Builder by lazy { - Retrofit.Builder() - .baseUrl(baseUrl) - .addConverterFactory(ScalarsConverterFactory.create()) - .addConverterFactory(MoshiConverterFactory.create(serializerBuilder.build())) - } - - private val clientBuilder: OkHttpClient.Builder by lazy { - okHttpClientBuilder ?: defaultClientBuilder - } - - private val defaultClientBuilder: OkHttpClient.Builder by lazy { - OkHttpClient() - .newBuilder() - .addInterceptor(HttpLoggingInterceptor(object : HttpLoggingInterceptor.Logger { - override fun log(message: String) { - logger?.invoke(message) - } - }).apply { - level = HttpLoggingInterceptor.Level.BODY - }) - } - - init { - normalizeBaseUrl() - } - - constructor( - baseUrl: String = defaultBasePath, - okHttpClientBuilder: OkHttpClient.Builder? = null, - serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - authNames: Array - ) : this(baseUrl, okHttpClientBuilder, serializerBuilder) { - authNames.forEach { authName -> - val auth = when (authName) { - "api_key" -> ApiKeyAuth("header", "api_key")"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets") - else -> throw RuntimeException("auth name $authName not found in available auth names") - } - addAuthorization(authName, auth); - } - } - - constructor( - baseUrl: String = defaultBasePath, - okHttpClientBuilder: OkHttpClient.Builder? = null, - serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - authName: String, - clientId: String, - secret: String, - username: String, - password: String - ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { - getTokenEndPoint() - ?.setClientId(clientId) - ?.setClientSecret(secret) - ?.setUsername(username) - ?.setPassword(password) - } - - /** - * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Token request builder - */ - fun getTokenEndPoint(): TokenRequestBuilder? { - var result: TokenRequestBuilder? = null - apiAuthorizations.values.runOnFirst { - result = tokenRequestBuilder - } - return result - } - - /** - * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Authentication request builder - */ - fun getAuthorizationEndPoint(): AuthenticationRequestBuilder? { - var result: AuthenticationRequestBuilder? = null - apiAuthorizations.values.runOnFirst { - result = authenticationRequestBuilder - } - return result - } - - /** - * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one) - * @param accessToken Access token - * @return ApiClient - */ - fun setAccessToken(accessToken: String): ApiClient { - apiAuthorizations.values.runOnFirst { - setAccessToken(accessToken) - } - return this - } - - /** - * Helper method to configure the oauth accessCode/implicit flow parameters - * @param clientId Client ID - * @param clientSecret Client secret - * @param redirectURI Redirect URI - * @return ApiClient - */ - fun configureAuthorizationFlow(clientId: String, clientSecret: String, redirectURI: String): ApiClient { - apiAuthorizations.values.runOnFirst { - tokenRequestBuilder - .setClientId(clientId) - .setClientSecret(clientSecret) - .setRedirectURI(redirectURI) - authenticationRequestBuilder - ?.setClientId(clientId) - ?.setRedirectURI(redirectURI) - } - return this; - } - - /** - * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener Access token listener - * @return ApiClient - */ - fun registerAccessTokenListener(accessTokenListener: AccessTokenListener): ApiClient { - apiAuthorizations.values.runOnFirst { - registerAccessTokenListener(accessTokenListener) - } - return this; - } - - /** - * Adds an authorization to be used by the client - * @param authName Authentication name - * @param authorization Authorization interceptor - * @return ApiClient - */ - fun addAuthorization(authName: String, authorization: Interceptor): ApiClient { - if (apiAuthorizations.containsKey(authName)) { - throw RuntimeException("auth name $authName already in api authorizations") - } - apiAuthorizations[authName] = authorization - clientBuilder.addInterceptor(authorization) - return this - } - - fun setLogger(logger: (String) -> Unit): ApiClient { - this.logger = logger - return this - } - - fun createService(serviceClass: Class): S { - var usedClient: OkHttpClient? = null - this.okHttpClient?.let { usedClient = it } ?: run {usedClient = clientBuilder.build()} - return retrofitBuilder.client(usedClient).build().create(serviceClass) - } - - private fun normalizeBaseUrl() { - if (!baseUrl.endsWith("/")) { - baseUrl += "/" - } - } - - private inline fun Iterable.runOnFirst(callback: U.() -> Unit) { - for (element in this) { - if (element is U) { - callback.invoke(element) - break - } - } - } - - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt deleted file mode 100644 index 001e99325d2..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt +++ /dev/null @@ -1,56 +0,0 @@ -package org.openapitools.client.infrastructure - -class CollectionFormats { - - open class CSVParams { - - var params: List - - constructor(params: List) { - this.params = params - } - - constructor(vararg params: String) { - this.params = listOf(*params) - } - - override fun toString(): String { - return params.joinToString(",") - } - } - - open class SSVParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString(" ") - } - } - - class TSVParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString("\t") - } - } - - class PIPESParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString("|") - } - } - - class SPACEParams : SSVParams() -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt deleted file mode 100644 index 1804d1ae2bb..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.JsonDataException -import com.squareup.moshi.Moshi -import retrofit2.Response - -@Throws(JsonDataException::class) -inline fun Response<*>.getErrorResponse(serializerBuilder: Moshi.Builder = Serializer.moshiBuilder): T? { - val serializer = serializerBuilder.build() - val parser = serializer.adapter(T::class.java) - val response = errorBody()?.string() - if(response != null) { - return parser.fromJson(response) - } - return null -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 697559b2ec1..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index fafca8738f6..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index a4c17c3b49d..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index a66c335904e..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index a3df06cb6eb..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 6e619023a5c..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index af1e270325d..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index da9784198d1..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,374 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Deletes a pet - * - * @param apiKey (optional) - * @param petId Pet id to delete - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(apiKey: kotlin.String?, petId: kotlin.Long) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 08822c67e32..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,198 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 258a2540e9e..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,363 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index e7f366d02cd..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 9c22257e223..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf() -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 697559b2ec1..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index 7d40c8efbc2..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,38 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index ceb0fbc8fe6..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index ec768d1acef..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,58 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: kotlin.String? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index 66667bf07cd..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,60 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A pet for sale in the pet store - * @param id - * @param category - * @param name - * @param photoUrls - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 944b1cd0a14..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index 9697f07d5bf..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-string/bin/test/org/openapitools/client/PetApiTest.kt b/samples/client/petstore/kotlin-string/bin/test/org/openapitools/client/PetApiTest.kt deleted file mode 100644 index 5ae1468ad07..00000000000 --- a/samples/client/petstore/kotlin-string/bin/test/org/openapitools/client/PetApiTest.kt +++ /dev/null @@ -1,104 +0,0 @@ -package org.openapitools.client - -import io.kotlintest.shouldBe -import io.kotlintest.matchers.numerics.shouldBeGreaterThan -import io.kotlintest.matchers.string.shouldContain -import io.kotlintest.shouldThrow -import io.kotlintest.specs.ShouldSpec -import org.openapitools.client.apis.PetApi -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.models.Category -import org.openapitools.client.models.Pet -import org.openapitools.client.models.Tag - -class PetApiTest : ShouldSpec() { - init { - - val petId:Long = 10006 - val api = PetApi() - - should("add a pet") { - - val pet = Pet( - id = petId, - name = "kotlin client test", - photoUrls = listOf("http://test_kotlin_unit_test.com"), - category = Category(petId, "test kotlin category"), - tags = listOf(Tag(petId, "test kotlin tag")) - ) - api.addPet(pet) - - } - - should("get pet by id") { - val result = api.getPetById(petId) - - result.id shouldBe (petId) - result.name shouldBe ("kotlin client test") - result.photoUrls[0] shouldBe ("http://test_kotlin_unit_test.com") - result.category!!.id shouldBe (petId) - result.category!!.name shouldBe ("test kotlin category") - result.tags!![0].id shouldBe (petId) - result.tags!![0].name shouldBe ("test kotlin tag") - - } - - should("find pet by status") { - val result = api.findPetsByStatus(listOf("available")) - - result.size.shouldBeGreaterThan(0) - - for(onePet in result) { - onePet.status.shouldBe(Pet.Status.available) - } - - val result2 = api.findPetsByStatus(listOf("unknown_and_incorrect_status")) - - result2.size.shouldBe(0) - - } - - should("update a pet") { - val pet = Pet( - id = petId, - name = "kotlin client updatePet", - status = Pet.Status.pending, - photoUrls = listOf("http://test_kotlin_unit_test.com") - ) - api.updatePet(pet) - - // verify updated Pet - val result = api.getPetById(petId) - result.id shouldBe (petId) - result.name shouldBe ("kotlin client updatePet") - result.status shouldBe (Pet.Status.pending) - - } - - should("update a pet with form") { - val name = "kotlin client updatePet with Form" - val status = "pending" - - api.updatePetWithForm(petId, name, status) - - // verify updated Pet - val result = api.getPetById(petId) - result.id shouldBe (petId) - result.name shouldBe ("kotlin client updatePet with Form") - result.status shouldBe (Pet.Status.pending) - - } - - should("delete a pet") { - api.deletePet("apiKey", petId) - - // verify updated Pet - val exception = shouldThrow { - api.getPetById(petId) - } - exception.message?.shouldContain("Pet not found") - } - - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index e4f7f4eeae0..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,374 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 08822c67e32..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,198 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 258a2540e9e..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,363 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index cb540f6ebd7..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import org.threeten.bp.LocalDate -import org.threeten.bp.LocalDateTime -import org.threeten.bp.LocalTime -import org.threeten.bp.OffsetDateTime -import org.threeten.bp.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index ff5439aeb42..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import org.threeten.bp.LocalDate -import org.threeten.bp.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index 710a9cc1317..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import org.threeten.bp.LocalDateTime -import org.threeten.bp.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 28b3eb3cd70..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import org.threeten.bp.OffsetDateTime -import org.threeten.bp.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 9c22257e223..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf() -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 697559b2ec1..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index fafca8738f6..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index a4c17c3b49d..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index 300f94d8545..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: org.threeten.bp.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index a3df06cb6eb..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 6e619023a5c..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index af1e270325d..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-threetenbp/bin/test/org/openapitools/client/PetApiTest.kt b/samples/client/petstore/kotlin-threetenbp/bin/test/org/openapitools/client/PetApiTest.kt deleted file mode 100644 index 5da4f9082a8..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/test/org/openapitools/client/PetApiTest.kt +++ /dev/null @@ -1,104 +0,0 @@ -package org.openapitools.client - -import io.kotlintest.shouldBe -import io.kotlintest.matchers.numerics.shouldBeGreaterThan -import io.kotlintest.matchers.string.shouldContain -import io.kotlintest.shouldThrow -import io.kotlintest.specs.ShouldSpec -import org.openapitools.client.apis.PetApi -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.models.Category -import org.openapitools.client.models.Pet -import org.openapitools.client.models.Tag - -class PetApiTest : ShouldSpec() { - init { - - val petId:Long = 10006 - val api = PetApi() - - should("add a pet") { - - val pet = Pet( - id = petId, - name = "kotlin client test", - photoUrls = listOf("http://test_kotlin_unit_test.com"), - category = Category(petId, "test kotlin category"), - tags = listOf(Tag(petId, "test kotlin tag")) - ) - api.addPet(pet) - - } - - should("get pet by id") { - val result = api.getPetById(petId) - - result.id shouldBe (petId) - result.name shouldBe ("kotlin client test") - result.photoUrls[0] shouldBe ("http://test_kotlin_unit_test.com") - result.category!!.id shouldBe (petId) - result.category!!.name shouldBe ("test kotlin category") - result.tags!![0].id shouldBe (petId) - result.tags!![0].name shouldBe ("test kotlin tag") - - } - - should("find pet by status") { - val result = api.findPetsByStatus(listOf("available")) - - result.size.shouldBeGreaterThan(0) - - for(onePet in result) { - onePet.status.shouldBe(Pet.Status.available) - } - - val result2 = api.findPetsByStatus(listOf("unknown_and_incorrect_status")) - - result2.size.shouldBe(0) - - } - - should("update a pet") { - val pet = Pet( - id = petId, - name = "kotlin client updatePet", - status = Pet.Status.pending, - photoUrls = listOf("http://test_kotlin_unit_test.com") - ) - api.updatePet(pet) - - // verify updated Pet - val result = api.getPetById(petId) - result.id shouldBe (petId) - result.name shouldBe ("kotlin client updatePet") - result.status shouldBe (Pet.Status.pending) - - } - - should("update a pet with form") { - val name = "kotlin client updatePet with Form" - val status = "pending" - - api.updatePetWithForm(petId, name, status) - - // verify updated Pet - val result = api.getPetById(petId) - result.id shouldBe (petId) - result.name shouldBe ("kotlin client updatePet with Form") - result.status shouldBe (Pet.Status.pending) - - } - - should("delete a pet") { - api.deletePet(petId, "apiKey") - - // verify updated Pet - val exception = shouldThrow { - api.getPetById(petId) - } - exception.message?.shouldContain("Pet not found") - } - - } - -} diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index 72d24c820e7..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,278 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.* - -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - */ - fun addPet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional, default to null) - * @return void - */ - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf("api_key" to apiKey.toString()) - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.Array - */ - @Suppress("UNCHECKED_CAST") - fun findPetsByStatus(status: kotlin.Array) : kotlin.Array { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mapOf("status" to toMultiValue(status.toList(), "csv")) - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request>( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as kotlin.Array - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.Array - */ - @Suppress("UNCHECKED_CAST") - fun findPetsByTags(tags: kotlin.Array) : kotlin.Array { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mapOf("tags" to toMultiValue(tags.toList(), "csv")) - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request>( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as kotlin.Array - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - */ - @Suppress("UNCHECKED_CAST") - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Pet - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - */ - fun updatePet(body: Pet) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional, default to null) - * @param status Updated status of the pet (optional, default to null) - * @return void - */ - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String, status: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = mapOf("name" to "$name", "status" to "$status") - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) - * @return ApiResponse - */ - @Suppress("UNCHECKED_CAST") - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String, file: java.io.File) : ApiResponse { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to "$additionalMetadata", "file" to "$file") - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as ApiResponse - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - -} diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 48ecd493a1e..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,146 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.* - -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - */ - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational reponses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Rediration responses.") - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - */ - @Suppress("UNCHECKED_CAST") - fun getInventory() : kotlin.collections.Map { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request>( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - */ - @Suppress("UNCHECKED_CAST") - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Order - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - */ - @Suppress("UNCHECKED_CAST") - fun placeOrder(body: Order) : Order { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Order - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - -} diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 130def3847f..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,271 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.* - -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - */ - fun createUser(body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - */ - fun createUsersWithArrayInput(body: kotlin.Array) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - */ - fun createUsersWithListInput(body: kotlin.Array) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - */ - fun deleteUser(username: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - */ - @Suppress("UNCHECKED_CAST") - fun getUserByName(username: kotlin.String) : User { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as User - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - */ - @Suppress("UNCHECKED_CAST") - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mapOf("username" to listOf("$username"), "password" to listOf("$password")) - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as kotlin.String - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Logs out current logged in user session - * - * @return void - */ - fun logoutUser() : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - */ - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mapOf() - val localVariableHeaders: kotlin.collections.Map = mapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val response = request( - localVariableConfig, - localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - else -> throw kotlin.IllegalStateException("Undefined ResponseType.") - } - } - -} diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index c2c3f1f0eae..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = Map> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipes" -> "|" - "ssv" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: List, collectionFormat: String, map: (item: Any?) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.map(map).joinToString(separator = collectionDelimiter(collectionFormat))) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 9e79028a90b..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,141 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.Moshi -import com.squareup.moshi.ToJson -import okhttp3.* -import java.io.File -import java.util.* - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val XmlMediaType = "application/xml" - - @JvmStatic - val client by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - - @JvmStatic - var defaultHeaders: Map by ApplicationDelegates.setOnce(mapOf(ContentType to JsonMediaType, Accept to JsonMediaType)) - - @JvmStatic - val jsonHeaders: Map = mapOf(ContentType to JsonMediaType, Accept to JsonMediaType) - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> RequestBody.create( - MediaType.parse(mediaType), content - ) - mediaType == FormDataMediaType -> { - var builder = FormBody.Builder() - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { key, value -> - builder = builder.add(key, value) - } - builder.build() - } - mediaType == JsonMediaType -> RequestBody.create( - MediaType.parse(mediaType), Serializer.moshi.adapter(T::class.java).toJson(content) - ) - mediaType == XmlMediaType -> TODO("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> TODO("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String = JsonMediaType): T? { - if(body == null) return null - return when(mediaType) { - JsonMediaType -> Moshi.Builder().add(object { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - @FromJson - fun fromJson(s: String) = UUID.fromString(s) - }) - .add(ByteArrayAdapter()) - .build().adapter(T::class.java).fromJson(body.source()) - else -> TODO() - } - } - - protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { - val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.") - - var urlBuilder = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - urlBuilder = urlBuilder.addQueryParameter(query.key, queryValue) - } - } - - val url = urlBuilder.build() - val headers = requestConfig.headers + defaultHeaders - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType,accept options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - val accept = (headers[Accept] as String).substringBefore(";").toLowerCase() - - var request : Request.Builder = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete() - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - } - - headers.forEach { header -> request = request.addHeader(header.key, header.value) } - - val realRequest = request.build() - val response = client.newCall(realRequest).execute() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code(), - response.headers().toMultimap() - ) - response.isInformational -> return Informational( - response.message(), - response.code(), - response.headers().toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body(), accept), - response.code(), - response.headers().toMultimap() - ) - response.isClientError -> return ClientError( - response.body()?.string(), - response.code(), - response.headers().toMultimap() - ) - else -> return ServerError( - null, - response.body()?.string(), - response.code(), - response.headers().toMultimap() - ) - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index f1a8aecc914..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,40 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -abstract class ApiInfrastructureResponse(val responseType: ResponseType) { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index 617ac3fe906..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index 2f3b0157ba7..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,42 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException : RuntimeException { - - /** - * Constructs an [ClientException] with no detail message. - */ - constructor() : super() - - /** - * Constructs an [ClientException] with the specified detail message. - - * @param message the detail message. - */ - constructor(message: kotlin.String) : super(message) - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException : RuntimeException { - - /** - * Constructs an [ServerException] with no detail message. - */ - constructor() : super() - - /** - * Constructs an [ServerException] with the specified detail message. - - * @param message the detail message. - */ - constructor(message: kotlin.String) : super(message) - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 86e2dadf9a8..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: Map = mapOf(), - val query: Map> = mapOf() -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index f50104a6f35..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code() in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -val Response.isRedirect : Boolean get() = this.code() in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code() in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code() in 500..999 \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index cf3fe8203d5..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.KotlinJsonAdapterFactory -import com.squareup.moshi.Moshi -import com.squareup.moshi.Rfc3339DateJsonAdapter -import java.util.* - -object Serializer { - @JvmStatic - val moshi: Moshi = Moshi.Builder() - .add(KotlinJsonAdapterFactory()) - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) - .build() -} diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index b950bdafb57..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,28 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ -data class ApiResponse ( - val code: kotlin.Int? = null, - val type: kotlin.String? = null, - val message: kotlin.String? = null -) { - -} - diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Category.kt deleted file mode 100644 index af700f5488a..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,26 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -/** - * A category for a pet - * @param id - * @param name - */ -data class Category ( - val id: kotlin.Long? = null, - val name: kotlin.String? = null -) { - -} - diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Order.kt deleted file mode 100644 index 44a8b1f896c..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,50 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ -data class Order ( - val id: kotlin.Long? = null, - val petId: kotlin.Long? = null, - val quantity: kotlin.Int? = null, - val shipDate: java.time.LocalDateTime? = null, - /* Order Status */ - val status: Order.Status? = null, - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - enum class Status(val value: kotlin.String){ - - @Json(name = "placed") placed("placed"), - - @Json(name = "approved") approved("approved"), - - @Json(name = "delivered") delivered("delivered"); - - } - -} - diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Pet.kt deleted file mode 100644 index 583dd3fb3ae..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,52 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json -/** - * A pet for sale in the pet store - * @param id - * @param category - * @param name - * @param photoUrls - * @param tags - * @param status pet status in the store - */ -data class Pet ( - val name: kotlin.String, - val photoUrls: kotlin.Array, - val id: kotlin.Long? = null, - val category: Category? = null, - val tags: kotlin.Array? = null, - /* pet status in the store */ - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - enum class Status(val value: kotlin.String){ - - @Json(name = "available") available("available"), - - @Json(name = "pending") pending("pending"), - - @Json(name = "sold") sold("sold"); - - } - -} - diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Tag.kt deleted file mode 100644 index d2ae2ead613..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,26 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -/** - * A tag for a pet - * @param id - * @param name - */ -data class Tag ( - val id: kotlin.Long? = null, - val name: kotlin.String? = null -) { - -} - diff --git a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin/bin/org/openapitools/client/models/User.kt deleted file mode 100644 index a9695bb62ba..00000000000 --- a/samples/client/petstore/kotlin/bin/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,39 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* OpenAPI spec version: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ -data class User ( - val id: kotlin.Long? = null, - val username: kotlin.String? = null, - val firstName: kotlin.String? = null, - val lastName: kotlin.String? = null, - val email: kotlin.String? = null, - val password: kotlin.String? = null, - val phone: kotlin.String? = null, - /* User Status */ - val userStatus: kotlin.Int? = null -) { - -} - From c96764f563e27033bed3f38894c8d04a9f8ebe9a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 24 Jan 2021 16:48:45 +0800 Subject: [PATCH 25/54] add apideck as the bronze sponsor (#8523) --- README.md | 1 + website/src/dynamic/sponsors.yml | 5 +++++ website/static/img/companies/apideck.jpg | Bin 0 -> 8192 bytes 3 files changed, 6 insertions(+) create mode 100644 website/static/img/companies/apideck.jpg diff --git a/README.md b/README.md index 1a12fb8b928..cadd93acc9f 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ If you find OpenAPI Generator useful for work, please consider asking your compa [](https://docspring.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) [](https://datadoghq.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) [](https://cpl.thalesgroup.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) +[](https://www.apideck.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor) #### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS and Checkly for sponsoring the API monitoring diff --git a/website/src/dynamic/sponsors.yml b/website/src/dynamic/sponsors.yml index 68bcf586a17..6da3f67caf0 100644 --- a/website/src/dynamic/sponsors.yml +++ b/website/src/dynamic/sponsors.yml @@ -23,3 +23,8 @@ image: "img/companies/thales.jpg" infoLink: "https://cpl.thalesgroup.com/?utm_source=openapi_generator&utm_medium=official_website&utm_campaign=sponsor" bronze: true +- + caption: "Apideck" + image: "img/companies/apideck.jpg" + infoLink: "https://www.apideck.com/?utm_source=openapi_generator&utm_medium=official_website&utm_campaign=sponsor" + bronze: true diff --git a/website/static/img/companies/apideck.jpg b/website/static/img/companies/apideck.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d0e2604c01c522be58104dcd4fe92324a86ec856 GIT binary patch literal 8192 zcmcII1yof{x94&%UH8(0bSToGG)k8=(jg@wA>C;p-5tWEK|-V@q)ViwLFw-NK;a#X z@B7zV@2$7qdhefm&&)o1cFjIBd-lxL#ML(dE-x)74L~3O00Do%)dEVUoP@+<6*XmP zIR&Yo9Vk&YrnXKnP5`jAb9Pjd5vS4C(WL?Yr5Kw!*^8;DDEtfRKY=G>*U|xCgzZ|^ zf9m|7Ua`%dIGKV5Vt|DFruL4`AS?>PN^Z{f*KiaF6Pa2Xn}Ki+2(vnZ27>V5HQwYG zymSp){DRM}VaG>m5&(dL1Hv>GzhKsD*yI;{Jr){MOGjIf#s-8LY;9aX8-AASk>EVB z(@+Q7n?D~XKn;)q!~q(>1aJYY02{y=U;|q_&}aWOANNl_CEyvzV+z*xfCu0Ra##SC zATKM3bpf1!Ctzz1;-7#&8;}Al|M>nNpE{ZIT+0K8j3W;KsEb!uhj#z~Jrw|cyuP}+ z$hx}vkqrRQ2>@u0`-lHo9O%v+5Fhmqjv*ZY@LvExb<;mMlUx9(0ewt1XK(Ci{8JAU ztWnI(0pK7X0C05xfDrUGmfruh|Chf(+1K)c>~R2iDiAbuR2UQm>?8-#DA0fD0zVlF6o!g+H3i^+coaAk4x%PS|FHfWTVHp+RG9hk zPN1z{Vl1EII+ZTA$nJv>`O}6UmJ-q@%VDbTz4iu58~K=2&4=0?JbsXqfBV}U{GRjD zab};eA9jy~ytuiw2?&j36}n|vF^|4FC6tOxrdm;%CZCg^HUH+o_$(yQWi6cLmE2+_ znZu;)XKi@rQw5QlX1|@@zPX>!4F+8?Bl$z=ADbgi8Tj>G2PibZIMKVdHF^ZPl8!Ho zt>P5A**1oKe_R0qZwZ_@{n7b&#vAnN%H__z8?~gRa!6onHLSam2i}>(t-rXT0z(B} z37N&u#NO1F=UIo|xHmVD*Ylj+v~R;70L+drL`=tzMsU+&f|F58&ZVE_c-R>^?fv5Y zUEfFlI-s9*#N+KPlQ)O0!Z~KeV{vS%{iqB1~%g<%|vHPbS6^HN9K384=Ol|_Z zZhIP&wqI5*Z&}coy<=c%j%zia&oMujNmzaT;Ex*NnXL-Xu_?dk*-y9AQ(@h#NlcR6 zY#fc*ut$`3N_wbUghq-VP@STW?*?|X(DK%-3slE0A3-x-{t|*mBH^3qNg=zgO#h#@lH%m{GqJbLHIpPV8BYDA{*Xy9Jh z-KPK`{N@9@wTjX4MF4M{ytw(-oRul%#1UMa-)t5{CG>np{&Vk*k_qpB&cN9{)Ll#+ zK0Ip$sIlyHcFcAYb0%>6Vwl9NB=cr-%~KvHkKpS4uZRy3CHQ36C3Iuh;xS4z|H1VtL-+7@^{2C$X0li#nwrcFZX89Y@?k)Mo^4{CLSvu8?AT4{X;B#hefaM!=wKva zg#!>MSWwXZgcB$P1qPs^(Qt|q5#L1+5|Gd`+*6@rjN$@g3kDc>AgCx;0174zG|S){ zcZOeB+*UxyCLRI>(b1<4-aS5`0{LgPIf`3mMi-k9KtTpYa@{v7iX#>u^^s%vr1l zsRlC|E=1%jMYBzl)g%vi`*R1o`1kspkgLCks2`xHa>N=))+#az^gC{w%vmt+SQALi zVOUOL4VCc(OGY``g94+RaB$Lnb)#vz+$cy6`A>!Xk$7g=@=SZrO^R7=yr~J`B*k^F zN$#xuWX6AhBavuk%ynDSV>i$AfFwDR_m%0(DdHxwbp(Qi_Iq`MUf)95a2XGYeq#`c zIwigC{PSo8FE{lk>yCzgwxi3AdXo+tF`lRAO*ICf%#KfwkH*a+NA+EI*w0q4Y1lPC zdX*6=*G(lnf<1YxF&^rXrvLVUeBa_+ajIwe3ZM)FH7ti;q}%tc9f)d@>5=OB&j*z` z$dzAH7WpO-&U{1c-@MLSyX z$zQC=gMFoePn>yJkjVx_y=!?|QrzWVqM8pv5G3K|{_?KE#JOFXO@@q2!W(wNg2W+& zmMXL%(FnrtIN(ZQLVzm;1r6MG|LnWhdoY3qMnK5P#Vx7|rxmj&`ng6xiU*KOEQl~I zH1f9b>kT-UCC~7nMee0J{mUcucLUG-yBjl^D;N|#6XuW5as4#bD_jgRy$UpCb7;7EF?;e>ICmDa1-pPoL3Njb-x=&$0Ezd zgrra*swezv&szX+a6sd5rII2pjC2iAzObl%;ySZH>ABbrrSfBcMxy-HXJ%?h-R8$> zcZoki(oFT|>6Xk#q@SnTIkHUOnq8i56jiW-EY<~8@?TiA^W~D%w{^B}-{5P}NB zK>L|eUB{)L2?v6Jh87(CT`@Qz5iyUrsu~@=vAsips6_NnPoP|T;sPr$VSXZ}l26`6 zZxW_Dw4$QOE#OEwOFbo2{UB3=@dZ{kX}s8!_4Yxfj`^&6+^4UEAHPXh*%ZrJ_5@BZ zCu4FYQfjhjrs7{{owwF0)HERHxPG+okZE?H2-(XSb5vV#=FAG=D<+(GVbU_lv0%d{ zHypH7JdA?5Z0@v8U~IG4KT>xUuUy}dH>{Et(!0MvS(4#^H#SiFGCBNM{zLJ;gpjuK zBC2xGgZW9zNF|rHv-dPFW8~M33ir{AXZX@4qCy_NZZN+4(n;lxDU1+Jz(ZV5obMsA za*&8@)T2v_Xf%`R{&iE=hqlkiY|ScTLf>Fzz&-63T{bJC=sswYDk3*R6_<2geMu7; z#wzH(Z>&aX_{CXrPxY)teF0x7X?D!^xJ5n2>MyH~o2At;=hu4kv742!5+mGAdB$qx zP!p~NIv?w{7-hicSbCG+m0g(UP{(e9Mz=&4wg?n4KkRky~VtiJXk>*9Lv5CZoO6ciXX z8kjx*+Nr=f0U&7UI7MLu^jtiuYQ_$ZF@)gkFbNP>i7qFic^-v?J7u*D{oYE@9-#bq z&eHI5pDV9(8KIG{p!(uX!CqUDu%Ksl8(u*^nuw}SB22C7R)|R{{OcG~JoG^63a~7Z z4U4sU_E%W;rcl0A&R`Y84i{b1pl6nHPPNM_B5bNPaPu$OUV-<*SxW43lSJHyI9}aSj)H1!v51#yD3glp+-oGp(&QF&hQhX10O!u)Y0S# z-q<8fUOP{JUOY#G3+X5<2hjoYyT=$q`32J9BI0+gHp0n0Us{fQxkfs44WsH{*<1ml z@0?qOrX!Cj@#9JZdX*o^eX3yXaL&t7>@1@Mzcd9ANG8zPS@(|MCq{2c*MG zN|VGr>FtXghesM)L(Nh)w7#Q~qgn2gbv<4wallt{eWyaAP8swKE{Oo>FkO8=OGv4m zqoKpBw!B-55=P`$L8nItNBC_2!;X7tBBPx`y>F09Y)d27k0B6kxvh}`i&vEsG3p#u zFVYenHwpz}?j@<0CKpVaP3fLt44E8~m2R4_%-@>i(yM$-ETvCLE!Xa!c;q&{ZM4cb z6P>MyQQqap5N_xoAts|+7y>J%Jh{*o=yBDdT-G3AZlzXISwWw#@cKzU8F-coV>ngU zo)Rw8dFK?fHF2aZ=)-F#=!@V_zJAZxj;wp9%NuRZDVd^pryRr#SLJEqHe|eP)fY?A zFkLbb8Es9|Nr^MJ(O;_P-RaG-aZogmaJX?xOt9e!;N=OGCoE2CZ(*UVK($s?i*U3_ z>~VETM@qt-LT?1UeaSJGl!Me)C+EHY`m)pfHLQapx>=rSVKlp8>Y*;~*L}sjtc&UJ z?UF<4j#WSgg=X%(96>ABF#aq2&{yZ1fRUM)@f zB2yIo%`PwZV?$jSfpYU;ZhbsIb3JoDc*6Mtw0=V^N0y49|k;HO}f(N7uR}Tn3NvJ(BmG&c}W_CZokC?FlXE z6@#13MomNLZ>8{NsdfxpDX-6OJ9Z6MogLS*85KkaJ`PPo zq*C5Y=}2G+a)Io&O;v?&_?FTweH5*~N9IZq3H7BcmM6++%S-vew>Q52F))8~;!}Fl zxMgsVvR5RJ--dki6J66uf6FHh3wD0WAD?o+8r-5PYEdz7X7^U?7m*;Tmqm3YYU<8TWPHi%sQSgjjcH1l$xn z5IgqVcfb`{#k(DhDm#4X+y5O)oD8)@34;*_hF3%K0~VqF3=woQFhE~FN$3iw+3CIE z>O5Bd01@IBPegDW^nPBH>$ZvlKA|;fylG#dCEDhCxM)bXRNvY3wls(P7BNcO($Q_e z|HaBkI400^>>| z!~jG`2LI@6XJNkM4`Q2}U?zsdA=y)OoY z_il@0P&WKBV&AXnsK|Tot^^LvAG3PMFLwQW7McOhR+c|j{k7Y4Iv{|h0>$zBE$X1H z<_ZwD>}dBF-uV7|K!2$J|6jp~%!s%?heKfy*q>}10;XM@TyQWX(}>zTAfxy8f5zhL zlL-6*s}#-7A+(OOUgntB@0g=gR(tHlgJ4A4#|&L4jI#{~{NK-OdNzqWcS2?yxMY|b z0dK?M$>r9vZGezl;c#}Fjm*Cie#j(i9EgKkd4p>;QrN?$lsaZ$A&|_@FB>&xiv|bY zhWn|pjX=P(p&h+a7{eIsG3ZQ_yp}#Q)p^U^IB<2kyPdObh-&D*m9JssS&(ty%Ji@V z4tL6ZT{(~_)dJpz-`fRh=3|-wD=Q|!{V06yCj+^Z+77-LQJkTryjvb#=a z&o^YHuyZphEJ0X;G2!-H=~x(J<-WstPBbBWZnaAHoW8}-#jm%j^`te|z}c_&jq}G8 z_*1{RIC-DoODWNQK4>mlWmJJ{R`C^pTG$+~jS_Uv{9R2+m#%}dOXL{dXu3~~D|@fF z_)0w&jFeFz906uNVO?sY!<)AfBlp}#I1_K$JG!mkfv$?mn9TbqEOH4fe;=ts|KJrH zRmVSg(1z8|Yd3QnhNO@!tnief69)`SP(AZ1lur!T<%^0+Hb2xEQNLmGOF?72ZKk*k zd4!V4IzL5va5{&R)B9G{bA&KCUV2Y_X5*EgW}U+sFR4|z;u;aN>pnYjE{?$c4MgVj zg@z(OS;A6VBdM03NnviEeWqYU`_ro1V$lMl9^C=Oi@?rj zk)$BfIm*ChII1SlndFb%%CAg+Vi{R4JzE?&L$8Vq;jiX;=Z&5bby$x~NU|pVHi6m8 zlpt}-U0}$yn+y<3L9gASuHb0-5aXI^7GLgUJuW=n^djcv6Xu-YI`|RQ7k;zI1x5KA>Jvb23qL!h)zmAQ zx6OhmIoS(ZTHmcopE|zg&4-eyPtGcck}3Gy%N*7woLRHt5!z*AhU-Z>BXqQqRoEsP{bnzBYWivt*tEMP3?U)U8e- zKz{@2oMpakdorEGd-Hkln;AgRyI!rSDSeV0+4b22_0!UM!mQYwP|m}oe&EA44Xp+I!DHl6WrB=QY|2fNAb@?6?;bX{v@>GScxQb!#;|SUQV$(2LB)Fo zuuw)YN<8A%dr{lcpA*%S^7Y+O<(OW9V}CQ$zJm9NY^{tfZ8~bvVNTEE#+J|Qy@ZW@ zS9vE_Oda_b1pOvT&d?MKVakWG4?@c?QYvcQ(LJ>b+7mldsbv%`KGdI>VHYc_I8Dq& zjbkl-TX&j^XpJemyS?i2KyN7%kGOVS&DQ4m;#g@(%01gqm|~pHs-DmVy0s7w}Fw-FwToyM7_Imnn*V|O8S_hh9|HV4?4mCm`AXcJLm@FVyq(vcw z;eks7koJ@^aMon*uz@CO@H8ZVPih%g(gNqhSzb~T?Nb3Ef^{9*4h-h}^g;}0p`nu& z2HK%_tL&AQfG7;I2P2R!{Xp*n!FX>xYCYJXg>)|y-#2`<(DsH9gF46O+*^Ife z<< Date: Sun, 24 Jan 2021 15:43:58 +0100 Subject: [PATCH 26/54] [Kotlin-Spring] Fix properties default value (#8373) * [Kotlin-Spring] Fix properties default value * Fix kotlin enum default * Update go sample --- .../org/openapitools/codegen/DefaultCodegen.java | 2 +- .../codegen/languages/AbstractKotlinCodegen.java | 12 ++++++++++-- .../resources/kotlin-spring/dataClassOptVar.mustache | 2 +- .../resources/kotlin-spring/dataClassReqVar.mustache | 2 +- .../client/petstore/go/go-petstore/docs/EnumTest.md | 2 +- .../petstore/go/go-petstore/model_enum_test_.go | 4 ++-- .../src/main/kotlin/org/openapitools/model/Order.kt | 2 +- .../src/main/kotlin/org/openapitools/model/Order.kt | 2 +- .../src/main/kotlin/org/openapitools/model/Order.kt | 2 +- 9 files changed, 19 insertions(+), 11 deletions(-) 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 e808a2bc1f7..1d30af652a8 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 @@ -5357,7 +5357,7 @@ public class DefaultCodegen implements CodegenConfig { if (var.defaultValue != null) { String enumName = null; final String enumDefaultValue; - if ("string".equalsIgnoreCase(dataType)) { + if (isDataTypeString(dataType)) { enumDefaultValue = toEnumValue(var.defaultValue, dataType); } else { enumDefaultValue = var.defaultValue; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java index 33ac8a95bb1..32c7c3cff45 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java @@ -898,7 +898,8 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co } @Override - public String toDefaultValue(Schema p) { + public String toDefaultValue(Schema schema) { + Schema p = ModelUtils.getReferencedSchema(this.openAPI, schema); if (ModelUtils.isBooleanSchema(p)) { if (p.getDefault() != null) { return p.getDefault().toString(); @@ -921,8 +922,15 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co } } else if (ModelUtils.isStringSchema(p)) { if (p.getDefault() != null) { - return "\"" + p.getDefault() + "\""; + String _default = (String) p.getDefault(); + if (p.getEnum() == null) { + return "\"" + escapeText(_default) + "\""; + } else { + // convert to enum var name later in postProcessModels + return _default; + } } + return null; } return null; diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache index ec3c8fd6983..0fca42a0ad8 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache @@ -1,4 +1,4 @@ {{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swaggerAnnotations}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}}{{#deprecated}} @Deprecated(message = ""){{/deprecated}} - @field:JsonProperty("{{{baseName}}}"){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{nameInCamelCase}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file + @field:JsonProperty("{{{baseName}}}"){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{nameInCamelCase}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultValue}}{{defaultValue}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache index 963baa8f9af..27e16f95fca 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache @@ -1,3 +1,3 @@ {{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swaggerAnnotations}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}required = true, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}} - @field:JsonProperty("{{{baseName}}}", required = true){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{nameInCamelCase}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isReadOnly}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}}{{/isReadOnly}} \ No newline at end of file + @field:JsonProperty("{{{baseName}}}", required = true){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{nameInCamelCase}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isReadOnly}}?{{/isReadOnly}}{{#defaultValue}} = {{defaultValue}}{{/defaultValue}}{{#isReadOnly}}{{^defaultValue}} = null{{/defaultValue}}{{/isReadOnly}} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumTest.md b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumTest.md index a1761a7cd72..75bf9867dac 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumTest.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumTest.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **EnumNumber** | Pointer to **float64** | | [optional] **OuterEnum** | Pointer to [**NullableOuterEnum**](OuterEnum.md) | | [optional] **OuterEnumInteger** | Pointer to [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] -**OuterEnumDefaultValue** | Pointer to [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] [default to "placed"] +**OuterEnumDefaultValue** | Pointer to [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] [default to OUTERENUMDEFAULTVALUE_PLACED] **OuterEnumIntegerDefaultValue** | Pointer to [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] [default to OUTERENUMINTEGERDEFAULTVALUE__0] ## Methods diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_enum_test_.go b/samples/openapi3/client/petstore/go/go-petstore/model_enum_test_.go index cab7c698817..bf7b8ca59c2 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/model_enum_test_.go +++ b/samples/openapi3/client/petstore/go/go-petstore/model_enum_test_.go @@ -36,7 +36,7 @@ type _EnumTest EnumTest func NewEnumTest(enumStringRequired string, ) *EnumTest { this := EnumTest{} this.EnumStringRequired = enumStringRequired - var outerEnumDefaultValue OuterEnumDefaultValue = "placed" + var outerEnumDefaultValue OuterEnumDefaultValue = OUTERENUMDEFAULTVALUE_PLACED this.OuterEnumDefaultValue = &outerEnumDefaultValue var outerEnumIntegerDefaultValue OuterEnumIntegerDefaultValue = OUTERENUMINTEGERDEFAULTVALUE__0 this.OuterEnumIntegerDefaultValue = &outerEnumIntegerDefaultValue @@ -48,7 +48,7 @@ func NewEnumTest(enumStringRequired string, ) *EnumTest { // but it doesn't guarantee that properties required by API are set func NewEnumTestWithDefaults() *EnumTest { this := EnumTest{} - var outerEnumDefaultValue OuterEnumDefaultValue = "placed" + var outerEnumDefaultValue OuterEnumDefaultValue = OUTERENUMDEFAULTVALUE_PLACED this.OuterEnumDefaultValue = &outerEnumDefaultValue var outerEnumIntegerDefaultValue OuterEnumIntegerDefaultValue = OUTERENUMINTEGERDEFAULTVALUE__0 this.OuterEnumIntegerDefaultValue = &outerEnumIntegerDefaultValue diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt index 203292a60ee..2de2fa35642 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt @@ -40,7 +40,7 @@ data class Order( @field:JsonProperty("status") val status: Order.Status? = null, @ApiModelProperty(example = "null", value = "") - @field:JsonProperty("complete") val complete: kotlin.Boolean? = null + @field:JsonProperty("complete") val complete: kotlin.Boolean? = false ) { /** diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt index 203292a60ee..2de2fa35642 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt @@ -40,7 +40,7 @@ data class Order( @field:JsonProperty("status") val status: Order.Status? = null, @ApiModelProperty(example = "null", value = "") - @field:JsonProperty("complete") val complete: kotlin.Boolean? = null + @field:JsonProperty("complete") val complete: kotlin.Boolean? = false ) { /** diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt index 203292a60ee..2de2fa35642 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt @@ -40,7 +40,7 @@ data class Order( @field:JsonProperty("status") val status: Order.Status? = null, @ApiModelProperty(example = "null", value = "") - @field:JsonProperty("complete") val complete: kotlin.Boolean? = null + @field:JsonProperty("complete") val complete: kotlin.Boolean? = false ) { /** From c5d4dc6d10ca911fc8f56f092e5cdcb2ad1ad74a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 25 Jan 2021 09:42:21 +0800 Subject: [PATCH 27/54] fix gradle test in appveyor (#8525) --- .../samples/local-spec/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties index f3b443b6b0c..cc9120b6ed8 100644 --- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties @@ -1,3 +1,3 @@ # RELEASE_VERSION -openApiGeneratorVersion=5.0.0-SNAPSHOT +openApiGeneratorVersion=5.0.1-SNAPSHOT # /RELEASE_VERSION From 57227e510f8b0be99b2fa1ba7b23e9d5573f8c3a Mon Sep 17 00:00:00 2001 From: Kuzma <57258237+ksvirkou-hubspot@users.noreply.github.com> Date: Mon, 25 Jan 2021 08:32:39 +0300 Subject: [PATCH 28/54] Remove servers urls with trailing slash (#7940) * remove trailing slash * update sample app * added tests * bug fix * Adds test in DefaultGeneratorTest * Reverts python files * Does not modify a value of / * Stops skipping / use case * update samples Co-authored-by: Justin Black Co-authored-by: William Cheng --- .../codegen/DefaultGenerator.java | 15 ++++++---- .../codegen/DefaultGeneratorTest.java | 29 +++++++++++++++++++ .../src/test/resources/3_0/issue_7533.yaml | 17 +++++++++++ .../org/openapitools/client/ApiClient.java | 2 +- 4 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/issue_7533.yaml diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 67bee20dbe0..e752c710c94 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -266,9 +266,9 @@ public class DefaultGenerator implements Generator { // TODO: Allow user to define _which_ servers object in the array to target. // Configures contextPath/basePath according to api document's servers URL url = URLPathUtils.getServerURL(openAPI, config.serverVariableOverrides()); - contextPath = config.escapeText(url.getPath()).replaceAll("/$", ""); // for backward compatibility + contextPath = removeTrailingSlash(config.escapeText(url.getPath())); // for backward compatibility basePathWithoutHost = contextPath; - basePath = config.escapeText(URLPathUtils.getHost(openAPI, config.serverVariableOverrides())).replaceAll("/$", ""); + basePath = removeTrailingSlash(config.escapeText(URLPathUtils.getHost(openAPI, config.serverVariableOverrides()))); } private void configureOpenAPIInfo() { @@ -552,7 +552,7 @@ public class DefaultGenerator implements Generator { } @SuppressWarnings("unchecked") - private void generateApis(List files, List allOperations, List allModels) { + void generateApis(List files, List allOperations, List allModels) { if (!generateApis) { // TODO: Process these anyway and present info via dryRun? LOGGER.info("Skipping generation of APIs."); @@ -580,7 +580,7 @@ public class DefaultGenerator implements Generator { Map operation = processOperations(config, tag, ops, allModels); URL url = URLPathUtils.getServerURL(openAPI, config.serverVariableOverrides()); operation.put("basePath", basePath); - operation.put("basePathWithoutHost", config.encodePath(url.getPath()).replaceAll("/$", "")); + operation.put("basePathWithoutHost", removeTrailingSlash(config.encodePath(url.getPath()))); operation.put("contextPath", contextPath); operation.put("baseName", tag); operation.put("apiPackage", config.apiPackage()); @@ -756,7 +756,7 @@ public class DefaultGenerator implements Generator { } @SuppressWarnings("unchecked") - private Map buildSupportFileBundle(List allOperations, List allModels) { + Map buildSupportFileBundle(List allOperations, List allModels) { Map bundle = new HashMap<>(config.additionalProperties()); bundle.put("apiPackage", config.apiPackage()); @@ -806,6 +806,7 @@ public class DefaultGenerator implements Generator { List servers = config.fromServers(openAPI.getServers()); if (servers != null && !servers.isEmpty()) { + servers.forEach(server -> server.url = removeTrailingSlash(server.url)); bundle.put("servers", servers); bundle.put("hasServers", true); } @@ -1483,4 +1484,8 @@ public class DefaultGenerator implements Generator { } } + private String removeTrailingSlash(String value) { + return StringUtils.removeEnd(value, "/"); + } + } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java index ad9f062ee56..7a22776af35 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java @@ -11,8 +11,11 @@ import io.swagger.v3.oas.models.parameters.QueryParameter; import io.swagger.v3.oas.models.parameters.RequestBody; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.responses.ApiResponses; +import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.config.GlobalSettings; +import org.openapitools.codegen.meta.GeneratorMetadata; +import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.utils.ModelUtils; import org.testng.Assert; import org.testng.annotations.Test; @@ -636,5 +639,31 @@ public class DefaultGeneratorTest { templates.toFile().delete(); } } + + @Test + public void testHandlesTrailingSlashInServers() { + OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7533.yaml"); + ClientOptInput opts = new ClientOptInput(); + opts.openAPI(openAPI); + DefaultCodegen config = new DefaultCodegen(); + config.setStrictSpecBehavior(false); + opts.config(config); + final DefaultGenerator generator = new DefaultGenerator(); + generator.opts(opts); + generator.configureGeneratorProperties(); + + List files = new ArrayList<>(); + List filteredSchemas = ModelUtils.getSchemasUsedOnlyInFormParam(openAPI); + List allModels = new ArrayList<>(); + generator.generateModels(files, allModels, filteredSchemas); + List allOperations = new ArrayList<>(); + generator.generateApis(files, allOperations, allModels); + + Map bundle = generator.buildSupportFileBundle(allOperations, allModels); + LinkedList servers = (LinkedList) bundle.get("servers"); + Assert.assertEquals(servers.get(0).url, ""); + Assert.assertEquals(servers.get(1).url, "http://trailingshlash.io:80/v1"); + Assert.assertEquals(servers.get(2).url, "http://notrailingslash.io:80/v2"); + } } diff --git a/modules/openapi-generator/src/test/resources/3_0/issue_7533.yaml b/modules/openapi-generator/src/test/resources/3_0/issue_7533.yaml new file mode 100644 index 00000000000..7d66422f558 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/issue_7533.yaml @@ -0,0 +1,17 @@ +openapi: 3.0.1 +info: + title: OpenAPI Petstore + description: "sample spec" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + version: 1.0.0 +servers: + - url: / + - url: http://trailingshlash.io:80/v1/ + - url: http://notrailingslash.io:80/v2 +tags: [] +paths: {} +components: + schemas: {} + securitySchemes: {} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java index 838e1910886..8b3dbdcebb0 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java @@ -72,7 +72,7 @@ public class ApiClient extends JavaTimeFormatter { protected List servers = new ArrayList(Arrays.asList( new ServerConfiguration( - "/", + "", "No description provided", new HashMap() ) From 3a56e3818f086975719ad1c33a63d238a8c48d16 Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@users.noreply.github.com> Date: Mon, 25 Jan 2021 05:34:10 +0000 Subject: [PATCH 29/54] [Swift 5] remove old swift sample (#8280) * [swift] remove old swift sample * [swift] update bitrise.yml * [swift] update unit tests --- CI/bitrise.yml | 2 +- pom.xml | 5 +- .../client/petstore/swift5/swift5_test_all.sh | 13 +- samples/client/test/swift5/default/.gitignore | 63 -- .../swift5/default/.openapi-generator-ignore | 23 - .../swift5/default/.openapi-generator/FILES | 58 -- .../swift5/default/.openapi-generator/VERSION | 1 - .../contents.xcworkspacedata | 7 - samples/client/test/swift5/default/Cartfile | 1 - samples/client/test/swift5/default/Info.plist | 22 - .../client/test/swift5/default/Package.swift | 31 - samples/client/test/swift5/default/README.md | 63 -- .../test/swift5/default/TestClient.podspec | 14 - .../TestClient.xcodeproj/project.pbxproj | 433 ------------- .../contents.xcworkspacedata | 7 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../xcschemes/TestClient.xcscheme | 93 --- .../Classes/OpenAPIs/APIHelper.swift | 71 --- .../TestClient/Classes/OpenAPIs/APIs.swift | 64 -- .../Classes/OpenAPIs/APIs/Swift5TestAPI.swift | 51 -- .../Classes/OpenAPIs/CodableHelper.swift | 48 -- .../Classes/OpenAPIs/Configuration.swift | 16 - .../Classes/OpenAPIs/Extensions.swift | 179 ------ .../Classes/OpenAPIs/JSONDataEncoding.swift | 53 -- .../Classes/OpenAPIs/JSONEncodingHelper.swift | 45 -- .../TestClient/Classes/OpenAPIs/Models.swift | 54 -- .../OpenAPIs/Models/AllPrimitives.swift | 72 --- .../Classes/OpenAPIs/Models/BaseCard.swift | 19 - .../Classes/OpenAPIs/Models/ErrorInfo.swift | 23 - .../OpenAPIs/Models/GetAllModelsResult.swift | 23 - .../OpenAPIs/Models/ModelDoubleArray.swift | 11 - .../OpenAPIs/Models/ModelErrorInfoArray.swift | 11 - .../OpenAPIs/Models/ModelStringArray.swift | 11 - ...ModelWithIntAdditionalPropertiesOnly.swift | 46 -- ...ithPropertiesAndAdditionalProperties.swift | 89 --- ...elWithStringAdditionalPropertiesOnly.swift | 46 -- .../Classes/OpenAPIs/Models/PersonCard.swift | 23 - .../OpenAPIs/Models/PersonCardAllOf.swift | 20 - .../Classes/OpenAPIs/Models/PlaceCard.swift | 23 - .../OpenAPIs/Models/PlaceCardAllOf.swift | 20 - .../Classes/OpenAPIs/Models/SampleBase.swift | 21 - .../OpenAPIs/Models/SampleSubClass.swift | 25 - .../OpenAPIs/Models/SampleSubClassAllOf.swift | 20 - .../Classes/OpenAPIs/Models/StringEnum.swift | 14 - .../OpenAPIs/Models/VariableNameTest.swift | 32 - .../OpenAPIs/OpenISO8601DateFormatter.swift | 44 -- .../OpenAPIs/SynchronizedDictionary.swift | 36 -- .../OpenAPIs/URLSessionImplementations.swift | 589 ------------------ .../swift5/default/TestClientApp/.gitignore | 72 --- .../test/swift5/default/TestClientApp/Podfile | 13 - .../swift5/default/TestClientApp/Podfile.lock | 16 - .../TestClientApp.xcodeproj/project.pbxproj | 546 ---------------- .../contents.xcworkspacedata | 7 - .../contents.xcworkspacedata | 10 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../TestClientApp/AppDelegate.swift | 43 -- .../AppIcon.appiconset/Contents.json | 93 --- .../Base.lproj/LaunchScreen.storyboard | 25 - .../TestClientApp/Base.lproj/Main.storyboard | 24 - .../TestClientApp/TestClientApp/Info.plist | 45 -- .../TestClientApp/ViewController.swift | 23 - .../TestClientAppTests/Info.plist | 22 - .../TestClientAppTests.swift | 35 -- .../test/swift5/default/TestClientApp/pom.xml | 43 -- .../default/TestClientApp/run_xcodebuild.sh | 5 - .../test/swift5/default/docs/AllPrimitives.md | 34 - .../test/swift5/default/docs/BaseCard.md | 10 - .../test/swift5/default/docs/ErrorInfo.md | 12 - .../swift5/default/docs/GetAllModelsResult.md | 12 - .../swift5/default/docs/ModelDoubleArray.md | 9 - .../default/docs/ModelErrorInfoArray.md | 9 - .../swift5/default/docs/ModelStringArray.md | 9 - .../ModelWithIntAdditionalPropertiesOnly.md | 9 - ...elWithPropertiesAndAdditionalProperties.md | 17 - ...ModelWithStringAdditionalPropertiesOnly.md | 9 - .../test/swift5/default/docs/PersonCard.md | 11 - .../swift5/default/docs/PersonCardAllOf.md | 11 - .../test/swift5/default/docs/PlaceCard.md | 11 - .../swift5/default/docs/PlaceCardAllOf.md | 11 - .../test/swift5/default/docs/SampleBase.md | 11 - .../swift5/default/docs/SampleSubClass.md | 13 - .../default/docs/SampleSubClassAllOf.md | 11 - .../test/swift5/default/docs/StringEnum.md | 9 - .../test/swift5/default/docs/Swift5TestAPI.md | 59 -- .../swift5/default/docs/VariableNameTest.md | 12 - .../client/test/swift5/default/git_push.sh | 58 -- samples/client/test/swift5/default/pom.xml | 43 -- .../client/test/swift5/default/project.yml | 14 - .../test/swift5/default/run_spmbuild.sh | 3 - samples/client/test/swift5/swift5_test_all.sh | 11 - 90 files changed, 11 insertions(+), 4080 deletions(-) delete mode 100644 samples/client/test/swift5/default/.gitignore delete mode 100644 samples/client/test/swift5/default/.openapi-generator-ignore delete mode 100644 samples/client/test/swift5/default/.openapi-generator/FILES delete mode 100644 samples/client/test/swift5/default/.openapi-generator/VERSION delete mode 100644 samples/client/test/swift5/default/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata delete mode 100644 samples/client/test/swift5/default/Cartfile delete mode 100644 samples/client/test/swift5/default/Info.plist delete mode 100644 samples/client/test/swift5/default/Package.swift delete mode 100644 samples/client/test/swift5/default/README.md delete mode 100644 samples/client/test/swift5/default/TestClient.podspec delete mode 100644 samples/client/test/swift5/default/TestClient.xcodeproj/project.pbxproj delete mode 100644 samples/client/test/swift5/default/TestClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 samples/client/test/swift5/default/TestClient.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 samples/client/test/swift5/default/TestClient.xcodeproj/xcshareddata/xcschemes/TestClient.xcscheme delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/APIHelper.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/APIs.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/APIs/Swift5TestAPI.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/CodableHelper.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Configuration.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Extensions.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/JSONDataEncoding.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/JSONEncodingHelper.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/AllPrimitives.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/BaseCard.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/ErrorInfo.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/GetAllModelsResult.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/ModelDoubleArray.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/ModelErrorInfoArray.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/ModelStringArray.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/ModelWithIntAdditionalPropertiesOnly.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/ModelWithPropertiesAndAdditionalProperties.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/ModelWithStringAdditionalPropertiesOnly.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/PersonCard.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/PersonCardAllOf.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/PlaceCard.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/PlaceCardAllOf.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/SampleBase.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/SampleSubClass.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/SampleSubClassAllOf.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/StringEnum.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/Models/VariableNameTest.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/SynchronizedDictionary.swift delete mode 100644 samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/URLSessionImplementations.swift delete mode 100644 samples/client/test/swift5/default/TestClientApp/.gitignore delete mode 100644 samples/client/test/swift5/default/TestClientApp/Podfile delete mode 100644 samples/client/test/swift5/default/TestClientApp/Podfile.lock delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientApp.xcodeproj/project.pbxproj delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientApp.xcworkspace/contents.xcworkspacedata delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientApp/AppDelegate.swift delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientApp/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientApp/Base.lproj/LaunchScreen.storyboard delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientApp/Base.lproj/Main.storyboard delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientApp/Info.plist delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientApp/ViewController.swift delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientAppTests/Info.plist delete mode 100644 samples/client/test/swift5/default/TestClientApp/TestClientAppTests/TestClientAppTests.swift delete mode 100644 samples/client/test/swift5/default/TestClientApp/pom.xml delete mode 100755 samples/client/test/swift5/default/TestClientApp/run_xcodebuild.sh delete mode 100644 samples/client/test/swift5/default/docs/AllPrimitives.md delete mode 100644 samples/client/test/swift5/default/docs/BaseCard.md delete mode 100644 samples/client/test/swift5/default/docs/ErrorInfo.md delete mode 100644 samples/client/test/swift5/default/docs/GetAllModelsResult.md delete mode 100644 samples/client/test/swift5/default/docs/ModelDoubleArray.md delete mode 100644 samples/client/test/swift5/default/docs/ModelErrorInfoArray.md delete mode 100644 samples/client/test/swift5/default/docs/ModelStringArray.md delete mode 100644 samples/client/test/swift5/default/docs/ModelWithIntAdditionalPropertiesOnly.md delete mode 100644 samples/client/test/swift5/default/docs/ModelWithPropertiesAndAdditionalProperties.md delete mode 100644 samples/client/test/swift5/default/docs/ModelWithStringAdditionalPropertiesOnly.md delete mode 100644 samples/client/test/swift5/default/docs/PersonCard.md delete mode 100644 samples/client/test/swift5/default/docs/PersonCardAllOf.md delete mode 100644 samples/client/test/swift5/default/docs/PlaceCard.md delete mode 100644 samples/client/test/swift5/default/docs/PlaceCardAllOf.md delete mode 100644 samples/client/test/swift5/default/docs/SampleBase.md delete mode 100644 samples/client/test/swift5/default/docs/SampleSubClass.md delete mode 100644 samples/client/test/swift5/default/docs/SampleSubClassAllOf.md delete mode 100644 samples/client/test/swift5/default/docs/StringEnum.md delete mode 100644 samples/client/test/swift5/default/docs/Swift5TestAPI.md delete mode 100644 samples/client/test/swift5/default/docs/VariableNameTest.md delete mode 100644 samples/client/test/swift5/default/git_push.sh delete mode 100644 samples/client/test/swift5/default/pom.xml delete mode 100644 samples/client/test/swift5/default/project.yml delete mode 100755 samples/client/test/swift5/default/run_spmbuild.sh delete mode 100755 samples/client/test/swift5/swift5_test_all.sh diff --git a/CI/bitrise.yml b/CI/bitrise.yml index 9cd05231017..f3bf6fec4c9 100644 --- a/CI/bitrise.yml +++ b/CI/bitrise.yml @@ -47,5 +47,5 @@ workflows: set -e - ./samples/client/test/swift5/swift5_test_all.sh + ./samples/client/petstore/swift5/swift5_test_all.sh diff --git a/pom.xml b/pom.xml index d30f231e13d..c6537ebf551 100644 --- a/pom.xml +++ b/pom.xml @@ -1443,17 +1443,18 @@ samples/client/petstore/swift5/rxswiftLibrary samples/client/petstore/swift5/urlsessionLibrary + + --> + - - - - - - - - - - - - - - - - diff --git a/samples/client/test/swift5/default/TestClientApp/TestClientApp/Base.lproj/Main.storyboard b/samples/client/test/swift5/default/TestClientApp/TestClientApp/Base.lproj/Main.storyboard deleted file mode 100644 index 7ef2ecfcfd9..00000000000 --- a/samples/client/test/swift5/default/TestClientApp/TestClientApp/Base.lproj/Main.storyboard +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/client/test/swift5/default/TestClientApp/TestClientApp/Info.plist b/samples/client/test/swift5/default/TestClientApp/TestClientApp/Info.plist deleted file mode 100644 index 16be3b68112..00000000000 --- a/samples/client/test/swift5/default/TestClientApp/TestClientApp/Info.plist +++ /dev/null @@ -1,45 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/samples/client/test/swift5/default/TestClientApp/TestClientApp/ViewController.swift b/samples/client/test/swift5/default/TestClientApp/TestClientApp/ViewController.swift deleted file mode 100644 index a5f289c421f..00000000000 --- a/samples/client/test/swift5/default/TestClientApp/TestClientApp/ViewController.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// ViewController.swift -// TestClientApp -// -// Created by Eric Hyche on 7/18/17. -// Copyright © 2017 Swagger Codegen. All rights reserved. -// - -import UIKit - -class ViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - // Do any additional setup after loading the view, typically from a nib. - } - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. - } - -} diff --git a/samples/client/test/swift5/default/TestClientApp/TestClientAppTests/Info.plist b/samples/client/test/swift5/default/TestClientApp/TestClientAppTests/Info.plist deleted file mode 100644 index 6c40a6cd0c4..00000000000 --- a/samples/client/test/swift5/default/TestClientApp/TestClientAppTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/samples/client/test/swift5/default/TestClientApp/TestClientAppTests/TestClientAppTests.swift b/samples/client/test/swift5/default/TestClientApp/TestClientAppTests/TestClientAppTests.swift deleted file mode 100644 index 42dd587fe00..00000000000 --- a/samples/client/test/swift5/default/TestClientApp/TestClientAppTests/TestClientAppTests.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// TestClientAppTests.swift -// TestClientAppTests -// -// Created by Eric Hyche on 7/18/17. -// Copyright © 2017 Swagger Codegen. All rights reserved. -// - -import XCTest -import TestClient -@testable import TestClientApp - -class TestClientAppTests: XCTestCase { - - func testWhenVariableNameIsDifferentFromPropertyName() throws { - // This tests to make sure that the swift4 language can handle when - // we have property names which map to variable names that are not the same. - // This can happen when we have things like snake_case property names, - // or when we have property names which may be Swift 4 reserved words. - let jsonData = """ - { - "example_name": "Test example name", - "for": "Some reason", - "normalName": "Some normal name value" - } - """.data(using: .utf8)! - - let decodedResult = CodableHelper.decode(VariableNameTest.self, from: jsonData) - let variableNameTest = try decodedResult.get() - - XCTAssertTrue(variableNameTest.exampleName == "Test example name", "Did not decode snake_case property correctly.") - XCTAssertTrue(variableNameTest._for == "Some reason", "Did not decode property name that is a reserved word correctly.") - } - -} diff --git a/samples/client/test/swift5/default/TestClientApp/pom.xml b/samples/client/test/swift5/default/TestClientApp/pom.xml deleted file mode 100644 index fdb3db1495b..00000000000 --- a/samples/client/test/swift5/default/TestClientApp/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - 4.0.0 - io.swagger - Swift4TestClientTests - pom - 1.0-SNAPSHOT - Swift4 Swagger Test Schema Client - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - xcodebuild-test - integration-test - - exec - - - ./run_xcodebuild.sh - - - - - - - diff --git a/samples/client/test/swift5/default/TestClientApp/run_xcodebuild.sh b/samples/client/test/swift5/default/TestClientApp/run_xcodebuild.sh deleted file mode 100755 index 060ec332217..00000000000 --- a/samples/client/test/swift5/default/TestClientApp/run_xcodebuild.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -pod install - -xcodebuild clean build build-for-testing -workspace "TestClientApp.xcworkspace" -scheme "TestClientApp" -destination "platform=iOS Simulator,name=iPhone 11 Pro Max,OS=latest" && xcodebuild test-without-building -workspace "TestClientApp.xcworkspace" -scheme "TestClientAppTests" -destination "platform=iOS Simulator,name=iPhone 11 Pro Max,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} diff --git a/samples/client/test/swift5/default/docs/AllPrimitives.md b/samples/client/test/swift5/default/docs/AllPrimitives.md deleted file mode 100644 index 1cfa94eaf73..00000000000 --- a/samples/client/test/swift5/default/docs/AllPrimitives.md +++ /dev/null @@ -1,34 +0,0 @@ -# AllPrimitives - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**myInteger** | **Int** | | [optional] -**myIntegerArray** | **[Int]** | | [optional] -**myLong** | **Int64** | | [optional] -**myLongArray** | **[Int64]** | | [optional] -**myFloat** | **Float** | | [optional] -**myFloatArray** | **[Float]** | | [optional] -**myDouble** | **Double** | | [optional] -**myDoubleArray** | **[Double]** | | [optional] -**myString** | **String** | | [optional] -**myStringArray** | **[String]** | | [optional] -**myBytes** | **Data** | | [optional] -**myBytesArray** | **[Data]** | | [optional] -**myBoolean** | **Bool** | | [optional] -**myBooleanArray** | **[Bool]** | | [optional] -**myDate** | **Date** | | [optional] -**myDateArray** | **[Date]** | | [optional] -**myDateTime** | **Date** | | [optional] -**myDateTimeArray** | **[Date]** | | [optional] -**myFile** | **URL** | | [optional] -**myFileArray** | **[URL]** | | [optional] -**myUUID** | **UUID** | | [optional] -**myUUIDArray** | **[UUID]** | | [optional] -**myStringEnum** | [**StringEnum**](StringEnum.md) | | [optional] -**myStringEnumArray** | [StringEnum] | | [optional] -**myInlineStringEnum** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/BaseCard.md b/samples/client/test/swift5/default/docs/BaseCard.md deleted file mode 100644 index 42d41b7db13..00000000000 --- a/samples/client/test/swift5/default/docs/BaseCard.md +++ /dev/null @@ -1,10 +0,0 @@ -# BaseCard - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**cardType** | **String** | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/ErrorInfo.md b/samples/client/test/swift5/default/docs/ErrorInfo.md deleted file mode 100644 index 5cc21d73ae1..00000000000 --- a/samples/client/test/swift5/default/docs/ErrorInfo.md +++ /dev/null @@ -1,12 +0,0 @@ -# ErrorInfo - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **Int** | | [optional] -**message** | **String** | | [optional] -**details** | **[String]** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/GetAllModelsResult.md b/samples/client/test/swift5/default/docs/GetAllModelsResult.md deleted file mode 100644 index 4de449547ae..00000000000 --- a/samples/client/test/swift5/default/docs/GetAllModelsResult.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetAllModelsResult - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**myPrimitiveArray** | [AllPrimitives] | | [optional] -**myPrimitive** | [**AllPrimitives**](AllPrimitives.md) | | [optional] -**myVariableNameTest** | [**VariableNameTest**](VariableNameTest.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/ModelDoubleArray.md b/samples/client/test/swift5/default/docs/ModelDoubleArray.md deleted file mode 100644 index 46a1e87a9ce..00000000000 --- a/samples/client/test/swift5/default/docs/ModelDoubleArray.md +++ /dev/null @@ -1,9 +0,0 @@ -# ModelDoubleArray - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/ModelErrorInfoArray.md b/samples/client/test/swift5/default/docs/ModelErrorInfoArray.md deleted file mode 100644 index 666ca4ccc0e..00000000000 --- a/samples/client/test/swift5/default/docs/ModelErrorInfoArray.md +++ /dev/null @@ -1,9 +0,0 @@ -# ModelErrorInfoArray - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/ModelStringArray.md b/samples/client/test/swift5/default/docs/ModelStringArray.md deleted file mode 100644 index a84e8f1d4bb..00000000000 --- a/samples/client/test/swift5/default/docs/ModelStringArray.md +++ /dev/null @@ -1,9 +0,0 @@ -# ModelStringArray - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/ModelWithIntAdditionalPropertiesOnly.md b/samples/client/test/swift5/default/docs/ModelWithIntAdditionalPropertiesOnly.md deleted file mode 100644 index 209683e4fdf..00000000000 --- a/samples/client/test/swift5/default/docs/ModelWithIntAdditionalPropertiesOnly.md +++ /dev/null @@ -1,9 +0,0 @@ -# ModelWithIntAdditionalPropertiesOnly - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/ModelWithPropertiesAndAdditionalProperties.md b/samples/client/test/swift5/default/docs/ModelWithPropertiesAndAdditionalProperties.md deleted file mode 100644 index 098c03d6882..00000000000 --- a/samples/client/test/swift5/default/docs/ModelWithPropertiesAndAdditionalProperties.md +++ /dev/null @@ -1,17 +0,0 @@ -# ModelWithPropertiesAndAdditionalProperties - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**myIntegerReq** | **Int** | | -**myIntegerOpt** | **Int** | | [optional] -**myPrimitiveReq** | [**AllPrimitives**](AllPrimitives.md) | | -**myPrimitiveOpt** | [**AllPrimitives**](AllPrimitives.md) | | [optional] -**myStringArrayReq** | **[String]** | | -**myStringArrayOpt** | **[String]** | | [optional] -**myPrimitiveArrayReq** | [AllPrimitives] | | -**myPrimitiveArrayOpt** | [AllPrimitives] | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/ModelWithStringAdditionalPropertiesOnly.md b/samples/client/test/swift5/default/docs/ModelWithStringAdditionalPropertiesOnly.md deleted file mode 100644 index ca910111612..00000000000 --- a/samples/client/test/swift5/default/docs/ModelWithStringAdditionalPropertiesOnly.md +++ /dev/null @@ -1,9 +0,0 @@ -# ModelWithStringAdditionalPropertiesOnly - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/PersonCard.md b/samples/client/test/swift5/default/docs/PersonCard.md deleted file mode 100644 index 385299f8768..00000000000 --- a/samples/client/test/swift5/default/docs/PersonCard.md +++ /dev/null @@ -1,11 +0,0 @@ -# PersonCard - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**firstName** | **String** | | [optional] -**lastName** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/PersonCardAllOf.md b/samples/client/test/swift5/default/docs/PersonCardAllOf.md deleted file mode 100644 index e4b78f76c9e..00000000000 --- a/samples/client/test/swift5/default/docs/PersonCardAllOf.md +++ /dev/null @@ -1,11 +0,0 @@ -# PersonCardAllOf - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**firstName** | **String** | | [optional] -**lastName** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/PlaceCard.md b/samples/client/test/swift5/default/docs/PlaceCard.md deleted file mode 100644 index 87002357ce0..00000000000 --- a/samples/client/test/swift5/default/docs/PlaceCard.md +++ /dev/null @@ -1,11 +0,0 @@ -# PlaceCard - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**placeName** | **String** | | [optional] -**placeAddress** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/PlaceCardAllOf.md b/samples/client/test/swift5/default/docs/PlaceCardAllOf.md deleted file mode 100644 index 5ed8d8a4d0e..00000000000 --- a/samples/client/test/swift5/default/docs/PlaceCardAllOf.md +++ /dev/null @@ -1,11 +0,0 @@ -# PlaceCardAllOf - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**placeName** | **String** | | [optional] -**placeAddress** | **String** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/SampleBase.md b/samples/client/test/swift5/default/docs/SampleBase.md deleted file mode 100644 index a7c7ac9722d..00000000000 --- a/samples/client/test/swift5/default/docs/SampleBase.md +++ /dev/null @@ -1,11 +0,0 @@ -# SampleBase - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**baseClassStringProp** | **String** | | [optional] -**baseClassIntegerProp** | **Int** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/SampleSubClass.md b/samples/client/test/swift5/default/docs/SampleSubClass.md deleted file mode 100644 index 435633ccde1..00000000000 --- a/samples/client/test/swift5/default/docs/SampleSubClass.md +++ /dev/null @@ -1,13 +0,0 @@ -# SampleSubClass - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**baseClassStringProp** | **String** | | [optional] -**baseClassIntegerProp** | **Int** | | [optional] -**subClassStringProp** | **String** | | [optional] -**subClassIntegerProp** | **Int** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/SampleSubClassAllOf.md b/samples/client/test/swift5/default/docs/SampleSubClassAllOf.md deleted file mode 100644 index 50a64944e82..00000000000 --- a/samples/client/test/swift5/default/docs/SampleSubClassAllOf.md +++ /dev/null @@ -1,11 +0,0 @@ -# SampleSubClassAllOf - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**subClassStringProp** | **String** | | [optional] -**subClassIntegerProp** | **Int** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/StringEnum.md b/samples/client/test/swift5/default/docs/StringEnum.md deleted file mode 100644 index b0009f7e826..00000000000 --- a/samples/client/test/swift5/default/docs/StringEnum.md +++ /dev/null @@ -1,9 +0,0 @@ -# StringEnum - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/docs/Swift5TestAPI.md b/samples/client/test/swift5/default/docs/Swift5TestAPI.md deleted file mode 100644 index fde288b3946..00000000000 --- a/samples/client/test/swift5/default/docs/Swift5TestAPI.md +++ /dev/null @@ -1,59 +0,0 @@ -# Swift5TestAPI - -All URIs are relative to *http://api.example.com/basePath* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**getAllModels**](Swift5TestAPI.md#getallmodels) | **GET** /allModels | Get all of the models - - -# **getAllModels** -```swift - open class func getAllModels(clientId: String, completion: @escaping (_ data: GetAllModelsResult?, _ error: Error?) -> Void) -``` - -Get all of the models - -This endpoint tests get a dictionary which contains examples of all of the models. - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import TestClient - -let clientId = "clientId_example" // String | id that represent the Api client - -// Get all of the models -Swift5TestAPI.getAllModels(clientId: clientId) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **clientId** | **String** | id that represent the Api client | - -### Return type - -[**GetAllModelsResult**](GetAllModelsResult.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/test/swift5/default/docs/VariableNameTest.md b/samples/client/test/swift5/default/docs/VariableNameTest.md deleted file mode 100644 index b99011e0a9e..00000000000 --- a/samples/client/test/swift5/default/docs/VariableNameTest.md +++ /dev/null @@ -1,12 +0,0 @@ -# VariableNameTest - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**exampleName** | **String** | This snake-case examle_name property name should be converted to a camelCase variable name like exampleName | [optional] -**_for** | **String** | This property name is a reserved word in most languages, including Swift 5. | [optional] -**normalName** | **String** | This model object property name should be unchanged from the JSON property name. | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/test/swift5/default/git_push.sh b/samples/client/test/swift5/default/git_push.sh deleted file mode 100644 index ced3be2b0c7..00000000000 --- a/samples/client/test/swift5/default/git_push.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/samples/client/test/swift5/default/pom.xml b/samples/client/test/swift5/default/pom.xml deleted file mode 100644 index 5caba9cb463..00000000000 --- a/samples/client/test/swift5/default/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - 4.0.0 - io.swagger - Swift4PetstoreClientTests - pom - 1.0-SNAPSHOT - Swift4 Swagger Petstore Client - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - xcodebuild-test - integration-test - - exec - - - ./run_spmbuild.sh - - - - - - - diff --git a/samples/client/test/swift5/default/project.yml b/samples/client/test/swift5/default/project.yml deleted file mode 100644 index c5d75afe8c0..00000000000 --- a/samples/client/test/swift5/default/project.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: TestClient -targets: - TestClient: - type: framework - platform: iOS - deploymentTarget: "10.0" - sources: [TestClient] - info: - path: ./Info.plist - version: 1.0 - settings: - APPLICATION_EXTENSION_API_ONLY: true - scheme: {} - diff --git a/samples/client/test/swift5/default/run_spmbuild.sh b/samples/client/test/swift5/default/run_spmbuild.sh deleted file mode 100755 index 1a9f585ad05..00000000000 --- a/samples/client/test/swift5/default/run_spmbuild.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -swift build && exit ${PIPESTATUS[0]} diff --git a/samples/client/test/swift5/swift5_test_all.sh b/samples/client/test/swift5/swift5_test_all.sh deleted file mode 100755 index dcb30d887c9..00000000000 --- a/samples/client/test/swift5/swift5_test_all.sh +++ /dev/null @@ -1,11 +0,0 @@ -#/bin/bash - -set -e - -DIRECTORY=`dirname $0` - -# example project with unit tests -mvn -f $DIRECTORY/default/TestClientApp/pom.xml integration-test - -# spm build -mvn -f $DIRECTORY/default/pom.xml integration-test From 58f486651e489ab9e7df0e3942a0303392a448f3 Mon Sep 17 00:00:00 2001 From: basyskom-dege <72982549+basyskom-dege@users.noreply.github.com> Date: Mon, 25 Jan 2021 08:32:43 +0100 Subject: [PATCH 30/54] [Qt5][C++] Removed deprecated functions to support Qt6 (#8234) * removed depricated functions * using preprocessor variable. Updated samples * added version check for random functions * added another version check to Json functions * Update modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache Co-authored-by: Martin Delille * Update modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache Co-authored-by: Martin Delille * Update modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache Co-authored-by: Martin Delille * Update modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache Co-authored-by: Martin Delille * Update modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache Co-authored-by: Martin Delille * Update modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache Co-authored-by: Martin Delille * Apply suggestions from code review Changed version check to Qt 5.15 to remove the warning of the deprecated functions when compiling with Qt 5.15 Co-authored-by: Martin Delille Co-authored-by: Martin Delille --- .../HttpFileElement.cpp.mustache | 12 ++- .../cpp-qt5-client/HttpRequest.cpp.mustache | 78 +++++++++++-------- .../cpp-qt5-client/HttpRequest.h.mustache | 6 ++ .../cpp-qt5-client/api-body.mustache | 4 +- .../cpp-qt5/client/PFXHttpFileElement.cpp | 12 ++- .../cpp-qt5/client/PFXHttpRequest.cpp | 76 +++++++++++------- .../petstore/cpp-qt5/client/PFXHttpRequest.h | 6 ++ .../petstore/cpp-qt5/client/PFXPetApi.cpp | 4 +- .../petstore/cpp-qt5/client/PFXStoreApi.cpp | 2 +- .../petstore/cpp-qt5/client/PFXUserApi.cpp | 4 +- 10 files changed, 132 insertions(+), 72 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache index ff515e56989..4163b8be316 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache @@ -57,9 +57,13 @@ QJsonValue {{prefix}}HttpFileElement::asJsonValue() const { if (!result) { qDebug() << "Error opening file " << local_filename; } - return QJsonDocument::fromBinaryData(bArray.data()).object(); +#if QT_VERSION >= 0x051500 + return QJsonDocument::fromJson(bArray.data()).object(); +#else + return QJsonDocument::fromBinaryData(bArray.data()).object(); +#endif } - + bool {{prefix}}HttpFileElement::fromStringValue(const QString &instr) { QFile file(local_filename); bool result = false; @@ -82,7 +86,11 @@ bool {{prefix}}HttpFileElement::fromJsonValue(const QJsonValue &jval) { file.remove(); } result = file.open(QIODevice::WriteOnly); +#if QT_VERSION >= 0x051500 + file.write(QJsonDocument(jval.toObject()).toJson()); +#else file.write(QJsonDocument(jval.toObject()).toBinaryData()); +#endif file.close(); if (!result) { qDebug() << "Error creating file " << local_filename; diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache index 57692b69d8a..4ce0cfb2d6d 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache @@ -6,7 +6,12 @@ #include #include #include -#include {{#contentCompression}} +#include +#if QT_VERSION >= 0x051500 + #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts +#else + #define SKIP_EMPTY_PARTS QString::SkipEmptyParts +#endif{{#contentCompression}} #include {{/contentCompression}} #include "{{prefix}}HttpRequest.h" @@ -46,7 +51,13 @@ void {{prefix}}HttpRequestInput::add_file(QString variable_name, QString local_f {{prefix}}HttpRequestWorker::{{prefix}}HttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager) : QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { + +#if QT_VERSION >= 0x051500 + randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch()); +#else qsrand(QDateTime::currentDateTime().toTime_t()); +#endif + if (manager == nullptr) { manager = new QNetworkAccessManager(this); } @@ -205,31 +216,36 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { // variable layout is MULTIPART boundary = QString("__-----------------------%1%2") - .arg(QDateTime::currentDateTime().toTime_t()) - .arg(qrand()); + #if QT_VERSION >= 0x051500 + .arg(QDateTime::currentDateTime().toSecsSinceEpoch()) + .arg(randomGenerator.generate()); + #else + .arg(QDateTime::currentDateTime().toTime_t()) + .arg(qrand()); + #endif QString boundary_delimiter = "--"; QString new_line = "\r\n"; // add variables foreach (QString key, input->vars.keys()) { // add boundary - request_content.append(boundary_delimiter); - request_content.append(boundary); - request_content.append(new_line); + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(new_line.toUtf8()); // add header request_content.append("Content-Disposition: form-data; "); - request_content.append(http_attribute_encode("name", key)); - request_content.append(new_line); + request_content.append(http_attribute_encode("name", key).toUtf8()); + request_content.append(new_line.toUtf8()); request_content.append("Content-Type: text/plain"); - request_content.append(new_line); + request_content.append(new_line.toUtf8()); // add header to body splitter - request_content.append(new_line); + request_content.append(new_line.toUtf8()); // add variable content - request_content.append(input->vars.value(key)); - request_content.append(new_line); + request_content.append(input->vars.value(key).toUtf8()); + request_content.append(new_line.toUtf8()); } // add files @@ -263,38 +279,38 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { } // add boundary - request_content.append(boundary_delimiter); - request_content.append(boundary); - request_content.append(new_line); + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(new_line.toUtf8()); // add header request_content.append( - QString("Content-Disposition: form-data; %1; %2").arg(http_attribute_encode("name", file_info->variable_name), http_attribute_encode("filename", file_info->request_filename))); - request_content.append(new_line); + QString("Content-Disposition: form-data; %1; %2").arg(http_attribute_encode("name", file_info->variable_name), http_attribute_encode("filename", file_info->request_filename)).toUtf8()); + request_content.append(new_line.toUtf8()); if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) { request_content.append("Content-Type: "); - request_content.append(file_info->mime_type); - request_content.append(new_line); + request_content.append(file_info->mime_type.toUtf8()); + request_content.append(new_line.toUtf8()); } request_content.append("Content-Transfer-Encoding: binary"); - request_content.append(new_line); + request_content.append(new_line.toUtf8()); // add header to body splitter - request_content.append(new_line); + request_content.append(new_line.toUtf8()); // add file content request_content.append(file.readAll()); - request_content.append(new_line); + request_content.append(new_line.toUtf8()); file.close(); } // add end of body - request_content.append(boundary_delimiter); - request_content.append(boundary); - request_content.append(boundary_delimiter); + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(boundary_delimiter.toUtf8()); } if (input->request_body.size() > 0) { @@ -408,14 +424,14 @@ void {{prefix}}HttpRequestWorker::on_reply_timeout(QNetworkReply *reply) { void {{prefix}}HttpRequestWorker::process_response(QNetworkReply *reply) { if (getResponseHeaders().contains(QString("Content-Disposition"))) { - auto contentDisposition = getResponseHeaders().value(QString("Content-Disposition").toUtf8()).split(QString(";"), QString::SkipEmptyParts); + auto contentDisposition = getResponseHeaders().value(QString("Content-Disposition").toUtf8()).split(QString(";"), SKIP_EMPTY_PARTS); auto contentType = - getResponseHeaders().contains(QString("Content-Type")) ? getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts).first() : QString(); + getResponseHeaders().contains(QString("Content-Type")) ? getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), SKIP_EMPTY_PARTS).first() : QString(); if ((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))) { QString filename = QUuid::createUuid().toString(); for (const auto &file : contentDisposition) { if (file.contains(QString("filename"))) { - filename = file.split(QString("="), QString::SkipEmptyParts).at(1); + filename = file.split(QString("="), SKIP_EMPTY_PARTS).at(1); break; } } @@ -425,14 +441,14 @@ void {{prefix}}HttpRequestWorker::process_response(QNetworkReply *reply) { } } else if (getResponseHeaders().contains(QString("Content-Type"))) { - auto contentType = getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts); + auto contentType = getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), SKIP_EMPTY_PARTS); if ((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))) { // TODO : Handle Multipart responses } else { if(headers.contains("Content-Encoding")){ - auto encoding = headers.value("Content-Encoding").split(QString(";"), QString::SkipEmptyParts); + auto encoding = headers.value("Content-Encoding").split(QString(";"), SKIP_EMPTY_PARTS); if(encoding.count() > 0){ - auto compressionTypes = encoding.first().split(',', QString::SkipEmptyParts); + auto compressionTypes = encoding.first().split(',', SKIP_EMPTY_PARTS); if(compressionTypes.contains("gzip", Qt::CaseInsensitive) || compressionTypes.contains("deflate", Qt::CaseInsensitive)){ response = decompress(reply->readAll()); } else if(compressionTypes.contains("identity", Qt::CaseInsensitive)){ diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache index e04b1eeb187..a853306225d 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache @@ -14,6 +14,9 @@ #include #include #include +#if QT_VERSION >= 0x051500 + #include +#endif #include "{{prefix}}HttpFileElement.h" @@ -86,6 +89,9 @@ private: bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; int httpResponseCode; +#if QT_VERSION >= 0x051500 + QRandomGenerator randomGenerator; +#endif void on_reply_timeout(QNetworkReply *reply); void on_reply_finished(QNetworkReply *reply); diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache index 9dbb60f4eeb..fb48260ace7 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache @@ -165,7 +165,7 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName {{/isBasicBearer}}{{#isBasicBasic}} if(!_username.isEmpty() && !_password.isEmpty()){ QByteArray b64; - b64.append(_username + ":" + _password); + b64.append(_username.toUtf8() + ":" + _password.toUtf8()); addHeaders("Authorization","Basic " + b64.toBase64()); }{{/isBasicBasic}}{{/authMethods}} {{#queryParams}}{{^collectionFormat}} @@ -230,7 +230,7 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName QString output({{paramName}});{{/isString}}{{#isByteArray}}QString output({{paramName}});{{/isByteArray}}{{^isString}}{{^isByteArray}}{{^isFile}} QString output = {{paramName}}.asJson();{{/isFile}}{{/isByteArray}}{{/isString}}{{#isFile}}{{#hasConsumes}}input.headers.insert("Content-Type", {{#consumes}}{{^-first}}, {{/-first}}"{{mediaType}}"{{/consumes}});{{/hasConsumes}} QByteArray output = {{paramName}}.asByteArray();{{/isFile}} - input.request_body.append(output); + input.request_body.append(output.toUtf8()); {{/isContainer}}{{/bodyParams}}{{#headerParams}} if (!::{{cppNamespace}}::toStringValue({{paramName}}).isEmpty()) { input.headers.insert("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}})); diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp index ef9e00ebea0..3bf0e799854 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp @@ -65,9 +65,13 @@ QJsonValue PFXHttpFileElement::asJsonValue() const { if (!result) { qDebug() << "Error opening file " << local_filename; } - return QJsonDocument::fromBinaryData(bArray.data()).object(); +#if QT_VERSION >= 0x051500 + return QJsonDocument::fromJson(bArray.data()).object(); +#else + return QJsonDocument::fromBinaryData(bArray.data()).object(); +#endif } - + bool PFXHttpFileElement::fromStringValue(const QString &instr) { QFile file(local_filename); bool result = false; @@ -90,7 +94,11 @@ bool PFXHttpFileElement::fromJsonValue(const QJsonValue &jval) { file.remove(); } result = file.open(QIODevice::WriteOnly); +#if QT_VERSION >= 0x051500 + file.write(QJsonDocument(jval.toObject()).toJson()); +#else file.write(QJsonDocument(jval.toObject()).toBinaryData()); +#endif file.close(); if (!result) { qDebug() << "Error creating file " << local_filename; diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp index e92c99f4f02..e81f8b4e1cc 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp @@ -17,6 +17,11 @@ #include #include #include +#if QT_VERSION >= 0x051500 + #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts +#else + #define SKIP_EMPTY_PARTS QString::SkipEmptyParts +#endif #include "PFXHttpRequest.h" @@ -53,7 +58,13 @@ void PFXHttpRequestInput::add_file(QString variable_name, QString local_filename PFXHttpRequestWorker::PFXHttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager) : QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { + +#if QT_VERSION >= 0x051500 + randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch()); +#else qsrand(QDateTime::currentDateTime().toTime_t()); +#endif + if (manager == nullptr) { manager = new QNetworkAccessManager(this); } @@ -212,31 +223,36 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { // variable layout is MULTIPART boundary = QString("__-----------------------%1%2") - .arg(QDateTime::currentDateTime().toTime_t()) - .arg(qrand()); + #if QT_VERSION >= 0x051500 + .arg(QDateTime::currentDateTime().toSecsSinceEpoch()) + .arg(randomGenerator.generate()); + #else + .arg(QDateTime::currentDateTime().toTime_t()) + .arg(qrand()); + #endif QString boundary_delimiter = "--"; QString new_line = "\r\n"; // add variables foreach (QString key, input->vars.keys()) { // add boundary - request_content.append(boundary_delimiter); - request_content.append(boundary); - request_content.append(new_line); + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(new_line.toUtf8()); // add header request_content.append("Content-Disposition: form-data; "); - request_content.append(http_attribute_encode("name", key)); - request_content.append(new_line); + request_content.append(http_attribute_encode("name", key).toUtf8()); + request_content.append(new_line.toUtf8()); request_content.append("Content-Type: text/plain"); - request_content.append(new_line); + request_content.append(new_line.toUtf8()); // add header to body splitter - request_content.append(new_line); + request_content.append(new_line.toUtf8()); // add variable content - request_content.append(input->vars.value(key)); - request_content.append(new_line); + request_content.append(input->vars.value(key).toUtf8()); + request_content.append(new_line.toUtf8()); } // add files @@ -270,38 +286,38 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { } // add boundary - request_content.append(boundary_delimiter); - request_content.append(boundary); - request_content.append(new_line); + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(new_line.toUtf8()); // add header request_content.append( - QString("Content-Disposition: form-data; %1; %2").arg(http_attribute_encode("name", file_info->variable_name), http_attribute_encode("filename", file_info->request_filename))); - request_content.append(new_line); + QString("Content-Disposition: form-data; %1; %2").arg(http_attribute_encode("name", file_info->variable_name), http_attribute_encode("filename", file_info->request_filename)).toUtf8()); + request_content.append(new_line.toUtf8()); if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) { request_content.append("Content-Type: "); - request_content.append(file_info->mime_type); - request_content.append(new_line); + request_content.append(file_info->mime_type.toUtf8()); + request_content.append(new_line.toUtf8()); } request_content.append("Content-Transfer-Encoding: binary"); - request_content.append(new_line); + request_content.append(new_line.toUtf8()); // add header to body splitter - request_content.append(new_line); + request_content.append(new_line.toUtf8()); // add file content request_content.append(file.readAll()); - request_content.append(new_line); + request_content.append(new_line.toUtf8()); file.close(); } // add end of body - request_content.append(boundary_delimiter); - request_content.append(boundary); - request_content.append(boundary_delimiter); + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(boundary_delimiter.toUtf8()); } if (input->request_body.size() > 0) { @@ -415,14 +431,14 @@ void PFXHttpRequestWorker::on_reply_timeout(QNetworkReply *reply) { void PFXHttpRequestWorker::process_response(QNetworkReply *reply) { if (getResponseHeaders().contains(QString("Content-Disposition"))) { - auto contentDisposition = getResponseHeaders().value(QString("Content-Disposition").toUtf8()).split(QString(";"), QString::SkipEmptyParts); + auto contentDisposition = getResponseHeaders().value(QString("Content-Disposition").toUtf8()).split(QString(";"), SKIP_EMPTY_PARTS); auto contentType = - getResponseHeaders().contains(QString("Content-Type")) ? getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts).first() : QString(); + getResponseHeaders().contains(QString("Content-Type")) ? getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), SKIP_EMPTY_PARTS).first() : QString(); if ((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))) { QString filename = QUuid::createUuid().toString(); for (const auto &file : contentDisposition) { if (file.contains(QString("filename"))) { - filename = file.split(QString("="), QString::SkipEmptyParts).at(1); + filename = file.split(QString("="), SKIP_EMPTY_PARTS).at(1); break; } } @@ -432,14 +448,14 @@ void PFXHttpRequestWorker::process_response(QNetworkReply *reply) { } } else if (getResponseHeaders().contains(QString("Content-Type"))) { - auto contentType = getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts); + auto contentType = getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), SKIP_EMPTY_PARTS); if ((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))) { // TODO : Handle Multipart responses } else { if(headers.contains("Content-Encoding")){ - auto encoding = headers.value("Content-Encoding").split(QString(";"), QString::SkipEmptyParts); + auto encoding = headers.value("Content-Encoding").split(QString(";"), SKIP_EMPTY_PARTS); if(encoding.count() > 0){ - auto compressionTypes = encoding.first().split(',', QString::SkipEmptyParts); + auto compressionTypes = encoding.first().split(',', SKIP_EMPTY_PARTS); if(compressionTypes.contains("gzip", Qt::CaseInsensitive) || compressionTypes.contains("deflate", Qt::CaseInsensitive)){ response = decompress(reply->readAll()); } else if(compressionTypes.contains("identity", Qt::CaseInsensitive)){ diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h index 2b1f1afe07c..cea7d43168c 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h @@ -24,6 +24,9 @@ #include #include #include +#if QT_VERSION >= 0x051500 + #include +#endif #include "PFXHttpFileElement.h" @@ -94,6 +97,9 @@ private: bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; int httpResponseCode; +#if QT_VERSION >= 0x051500 + QRandomGenerator randomGenerator; +#endif void on_reply_timeout(QNetworkReply *reply); void on_reply_finished(QNetworkReply *reply); diff --git a/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp index 6adce3da88d..42c59efa8e9 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp @@ -155,7 +155,7 @@ void PFXPetApi::addPet(const PFXPet &body) { PFXHttpRequestInput input(fullPath, "POST"); QString output = body.asJson(); - input.request_body.append(output); + input.request_body.append(output.toUtf8()); foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } @@ -459,7 +459,7 @@ void PFXPetApi::updatePet(const PFXPet &body) { PFXHttpRequestInput input(fullPath, "PUT"); QString output = body.asJson(); - input.request_body.append(output); + input.request_body.append(output.toUtf8()); foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } diff --git a/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp index 2c3113677d0..1dbc49ff86c 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp @@ -278,7 +278,7 @@ void PFXStoreApi::placeOrder(const PFXOrder &body) { PFXHttpRequestInput input(fullPath, "POST"); QString output = body.asJson(); - input.request_body.append(output); + input.request_body.append(output.toUtf8()); foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } diff --git a/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp index 21350d76465..aef910a0af9 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp @@ -155,7 +155,7 @@ void PFXUserApi::createUser(const PFXUser &body) { PFXHttpRequestInput input(fullPath, "POST"); QString output = body.asJson(); - input.request_body.append(output); + input.request_body.append(output.toUtf8()); foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } @@ -456,7 +456,7 @@ void PFXUserApi::updateUser(const QString &username, const PFXUser &body) { PFXHttpRequestInput input(fullPath, "PUT"); QString output = body.asJson(); - input.request_body.append(output); + input.request_body.append(output.toUtf8()); foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); } From cb530d4e7556c67a5155d8b410e1828206196797 Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 25 Jan 2021 09:13:23 +0100 Subject: [PATCH 31/54] Add .t in spec generation of Elixir structs (#8159) * Add .t in spec generation of object types * update samples * Adds workaround for free-form maps with propper typespec * Adds missing typsspec definition for structs * update doc Co-authored-by: William Cheng Co-authored-by: Michael Ramstein --- docs/generators/elixir.md | 2 + .../languages/ElixirClientCodegen.java | 18 +++--- .../src/main/resources/elixir/api.mustache | 4 +- .../src/main/resources/elixir/model.mustache | 4 +- .../lib/openapi_petstore/api/another_fake.ex | 4 +- .../elixir/lib/openapi_petstore/api/fake.ex | 56 +++++++++---------- .../api/fake_classname_tags123.ex | 4 +- .../elixir/lib/openapi_petstore/api/pet.ex | 32 +++++------ .../elixir/lib/openapi_petstore/api/store.ex | 14 ++--- .../elixir/lib/openapi_petstore/api/user.ex | 36 ++++++------ .../model/additional_properties_class.ex | 10 ++-- .../lib/openapi_petstore/model/array_test.ex | 2 +- .../lib/openapi_petstore/model/enum_test.ex | 2 +- .../model/file_schema_test_class.ex | 4 +- .../lib/openapi_petstore/model/format_test.ex | 1 - ...perties_and_additional_properties_class.ex | 2 +- .../elixir/lib/openapi_petstore/model/pet.ex | 4 +- 17 files changed, 100 insertions(+), 99 deletions(-) diff --git a/docs/generators/elixir.md b/docs/generators/elixir.md index 3c4d586c233..835a32834af 100644 --- a/docs/generators/elixir.md +++ b/docs/generators/elixir.md @@ -36,6 +36,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • Atom
  • Boolean
  • DateTime
  • +
  • Decimal
  • Float
  • Integer
  • List
  • @@ -43,6 +44,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • PID
  • String
  • Tuple
  • +
  • map()
  • ## RESERVED WORDS diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java index 728db0d2152..9ef6e2a5656 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java @@ -168,6 +168,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig Arrays.asList( "Integer", "Float", + "Decimal", "Boolean", "String", "List", @@ -175,7 +176,8 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig "Map", "Tuple", "PID", - "DateTime" + "DateTime", + "map()" // This is a workaround, since the DefaultCodeGen uses our elixir TypeSpec datetype to evaluate the primitive ) ); @@ -510,8 +512,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig } else if (ModelUtils.isDateTimeSchema(p)) { return "DateTime.t"; } else if (ModelUtils.isObjectSchema(p)) { - // TODO How to map it? - return super.getTypeDeclaration(p); + return "map()"; } else if (ModelUtils.isIntegerSchema(p)) { return "integer()"; } else if (ModelUtils.isNumberSchema(p)) { @@ -520,9 +521,8 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig return "String.t"; } else if (ModelUtils.isBooleanSchema(p)) { return "boolean()"; - } else if (!StringUtils.isEmpty(p.get$ref())) { // model - // How to map it? - return super.getTypeDeclaration(p); + } else if (!StringUtils.isEmpty(p.get$ref())) { + return this.moduleName + ".Model." + super.getTypeDeclaration(p) + ".t"; } else if (ModelUtils.isFileSchema(p)) { return "String.t"; } else if (ModelUtils.isStringSchema(p)) { @@ -593,12 +593,12 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig this.isDefinedDefault = (this.code.equals("0") || this.code.equals("default")); } - public String codeMappingKey(){ - if(this.isDefinedDefault) { + public String codeMappingKey() { + if (this.isDefinedDefault) { return ":default"; } - if(code.matches("^\\d{3}$")){ + if (code.matches("^\\d{3}$")) { return code; } diff --git a/modules/openapi-generator/src/main/resources/elixir/api.mustache b/modules/openapi-generator/src/main/resources/elixir/api.mustache index 999b7a661a6..ad3155fc2f2 100644 --- a/modules/openapi-generator/src/main/resources/elixir/api.mustache +++ b/modules/openapi-generator/src/main/resources/elixir/api.mustache @@ -35,8 +35,8 @@ defmodule {{moduleName}}.Api.{{classname}} do {{/optionalParams}} ## Returns - {:ok, {{#isArray}}[%{{&returnBaseType}}{}, ...]{{/isArray}}{{#isMap}}%{}{{/isMap}}{{^returnType}}%{}{{/returnType}}{{#returnSimpleType}}%{{#returnType}}{{#isMap}}{{/isMap}}{{{moduleName}}}.Model.{{{returnType}}}{{/returnType}}{}{{/returnSimpleType}}} on success - {:error, info} on failure + {:ok, {{#isArray}}[%{{&returnBaseType}}{}, ...]{{/isArray}}{{#isMap}}%{}{{/isMap}}{{^returnType}}nil{{/returnType}}{{#returnSimpleType}}{{#returnType}}{{#isMap}}{{/isMap}}{{{returnType}}}{{/returnType}}{{/returnSimpleType}}} on success + {:error, Tesla.Env.t} on failure """ {{{typespec}}} def {{{operationId}}}(connection, {{#requiredParams}}{{#underscored}}{{{paramName}}}{{/underscored}}, {{/requiredParams}}{{^hasOptionalParams}}_{{/hasOptionalParams}}opts \\ []) do diff --git a/modules/openapi-generator/src/main/resources/elixir/model.mustache b/modules/openapi-generator/src/main/resources/elixir/model.mustache index a990149ea3e..8f9c6fe0d17 100644 --- a/modules/openapi-generator/src/main/resources/elixir/model.mustache +++ b/modules/openapi-generator/src/main/resources/elixir/model.mustache @@ -23,8 +23,8 @@ defimpl Poison.Decoder, for: {{&moduleName}}.Model.{{&classname}} do value {{#vars}} {{^isPrimitiveType}} - {{#datatype}}|> deserialize(:"{{&baseName}}", {{#isArray}}:list, {{&moduleName}}.Model.{{{items.datatype}}}{{/isArray}}{{#isMap}}:map, {{&moduleName}}.Model.{{{items.datatype}}}{{/isMap}}{{#isDate}}:date, nil{{/isDate}}{{#isDateTime}}:date, nil{{/isDateTime}}{{^isDate}}{{^isDateTime}}{{^isMap}}{{^isArray}}:struct, {{moduleName}}.Model.{{dataType}}{{/isArray}}{{/isMap}}{{/isDateTime}}{{/isDate}}, options) - {{/datatype}} + {{#baseType}}|> deserialize(:"{{&baseName}}", {{#isArray}}:list, {{&moduleName}}.Model.{{{items.baseType}}}{{/isArray}}{{#isMap}}:map, {{&moduleName}}.Model.{{{items.baseType}}}{{/isMap}}{{#isDate}}:date, nil{{/isDate}}{{#isDateTime}}:date, nil{{/isDateTime}}{{^isDate}}{{^isDateTime}}{{^isMap}}{{^isArray}}:struct, {{moduleName}}.Model.{{baseType}}{{/isArray}}{{/isMap}}{{/isDateTime}}{{/isDate}}, options) + {{/baseType}} {{/isPrimitiveType}} {{/vars}} {{/hasComplexVars}} diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/another_fake.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/another_fake.ex index 7be04da1c9f..06d523d3118 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/another_fake.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/another_fake.ex @@ -22,8 +22,8 @@ defmodule OpenapiPetstore.Api.AnotherFake do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %OpenapiPetstore.Model.Client{}} on success - {:error, info} on failure + {:ok, OpenapiPetstore.Model.Client.t} on success + {:error, Tesla.Env.t} on failure """ @spec call_123_test_special_tags(Tesla.Env.client, OpenapiPetstore.Model.Client.t, keyword()) :: {:ok, OpenapiPetstore.Model.Client.t} | {:error, Tesla.Env.t} def call_123_test_special_tags(connection, body, _opts \\ []) do diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex index 84a92da683d..bd336856c78 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex @@ -22,8 +22,8 @@ defmodule OpenapiPetstore.Api.Fake do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec create_xml_item(Tesla.Env.client, OpenapiPetstore.Model.XmlItem.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def create_xml_item(connection, xml_item, _opts \\ []) do @@ -48,8 +48,8 @@ defmodule OpenapiPetstore.Api.Fake do - :body (boolean()): Input boolean as post body ## Returns - {:ok, %OpenapiPetstore.Model.boolean(){}} on success - {:error, info} on failure + {:ok, boolean()} on success + {:error, Tesla.Env.t} on failure """ @spec fake_outer_boolean_serialize(Tesla.Env.client, keyword()) :: {:ok, Boolean.t} | {:error, Tesla.Env.t} def fake_outer_boolean_serialize(connection, opts \\ []) do @@ -77,8 +77,8 @@ defmodule OpenapiPetstore.Api.Fake do - :body (OuterComposite): Input composite as post body ## Returns - {:ok, %OpenapiPetstore.Model.OuterComposite{}} on success - {:error, info} on failure + {:ok, OpenapiPetstore.Model.OuterComposite.t} on success + {:error, Tesla.Env.t} on failure """ @spec fake_outer_composite_serialize(Tesla.Env.client, keyword()) :: {:ok, OpenapiPetstore.Model.OuterComposite.t} | {:error, Tesla.Env.t} def fake_outer_composite_serialize(connection, opts \\ []) do @@ -106,8 +106,8 @@ defmodule OpenapiPetstore.Api.Fake do - :body (float()): Input number as post body ## Returns - {:ok, %OpenapiPetstore.Model.float(){}} on success - {:error, info} on failure + {:ok, float()} on success + {:error, Tesla.Env.t} on failure """ @spec fake_outer_number_serialize(Tesla.Env.client, keyword()) :: {:ok, Float.t} | {:error, Tesla.Env.t} def fake_outer_number_serialize(connection, opts \\ []) do @@ -135,8 +135,8 @@ defmodule OpenapiPetstore.Api.Fake do - :body (String.t): Input string as post body ## Returns - {:ok, %OpenapiPetstore.Model.String.t{}} on success - {:error, info} on failure + {:ok, String.t} on success + {:error, Tesla.Env.t} on failure """ @spec fake_outer_string_serialize(Tesla.Env.client, keyword()) :: {:ok, String.t} | {:error, Tesla.Env.t} def fake_outer_string_serialize(connection, opts \\ []) do @@ -164,8 +164,8 @@ defmodule OpenapiPetstore.Api.Fake do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec test_body_with_file_schema(Tesla.Env.client, OpenapiPetstore.Model.FileSchemaTestClass.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def test_body_with_file_schema(connection, body, _opts \\ []) do @@ -190,8 +190,8 @@ defmodule OpenapiPetstore.Api.Fake do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec test_body_with_query_params(Tesla.Env.client, String.t, OpenapiPetstore.Model.User.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def test_body_with_query_params(connection, query, body, _opts \\ []) do @@ -218,8 +218,8 @@ defmodule OpenapiPetstore.Api.Fake do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %OpenapiPetstore.Model.Client{}} on success - {:error, info} on failure + {:ok, OpenapiPetstore.Model.Client.t} on success + {:error, Tesla.Env.t} on failure """ @spec test_client_model(Tesla.Env.client, OpenapiPetstore.Model.Client.t, keyword()) :: {:ok, OpenapiPetstore.Model.Client.t} | {:error, Tesla.Env.t} def test_client_model(connection, body, _opts \\ []) do @@ -258,8 +258,8 @@ defmodule OpenapiPetstore.Api.Fake do - :callback (String.t): None ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec test_endpoint_parameters(Tesla.Env.client, float(), float(), String.t, binary(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def test_endpoint_parameters(connection, number, double, pattern_without_delimiter, byte, opts \\ []) do @@ -309,8 +309,8 @@ defmodule OpenapiPetstore.Api.Fake do - :enum_form_string (String.t): Form parameter enum test (string) ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec test_enum_parameters(Tesla.Env.client, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def test_enum_parameters(connection, opts \\ []) do @@ -352,8 +352,8 @@ defmodule OpenapiPetstore.Api.Fake do - :int64_group (integer()): Integer in group parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec test_group_parameters(Tesla.Env.client, integer(), boolean(), integer(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def test_group_parameters(connection, required_string_group, required_boolean_group, required_int64_group, opts \\ []) do @@ -386,8 +386,8 @@ defmodule OpenapiPetstore.Api.Fake do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec test_inline_additional_properties(Tesla.Env.client, %{optional(String.t) => String.t}, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def test_inline_additional_properties(connection, param, _opts \\ []) do @@ -413,8 +413,8 @@ defmodule OpenapiPetstore.Api.Fake do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec test_json_form_data(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def test_json_form_data(connection, param, param2, _opts \\ []) do @@ -444,8 +444,8 @@ defmodule OpenapiPetstore.Api.Fake do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec test_query_parameter_collection_format(Tesla.Env.client, list(String.t), list(String.t), list(String.t), list(String.t), list(String.t), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def test_query_parameter_collection_format(connection, pipe, ioutil, http, url, context, _opts \\ []) do diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake_classname_tags123.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake_classname_tags123.ex index 353dbcea396..64a3be9ebd7 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake_classname_tags123.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake_classname_tags123.ex @@ -22,8 +22,8 @@ defmodule OpenapiPetstore.Api.FakeClassnameTags123 do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %OpenapiPetstore.Model.Client{}} on success - {:error, info} on failure + {:ok, OpenapiPetstore.Model.Client.t} on success + {:error, Tesla.Env.t} on failure """ @spec test_classname(Tesla.Env.client, OpenapiPetstore.Model.Client.t, keyword()) :: {:ok, OpenapiPetstore.Model.Client.t} | {:error, Tesla.Env.t} def test_classname(connection, body, _opts \\ []) do diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex index 561f7af6f38..98802f5c2eb 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex @@ -21,8 +21,8 @@ defmodule OpenapiPetstore.Api.Pet do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec add_pet(Tesla.Env.client, OpenapiPetstore.Model.Pet.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def add_pet(connection, body, _opts \\ []) do @@ -49,8 +49,8 @@ defmodule OpenapiPetstore.Api.Pet do - :api_key (String.t): ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec delete_pet(Tesla.Env.client, integer(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def delete_pet(connection, pet_id, opts \\ []) do @@ -81,7 +81,7 @@ defmodule OpenapiPetstore.Api.Pet do ## Returns {:ok, [%Pet{}, ...]} on success - {:error, info} on failure + {:error, Tesla.Env.t} on failure """ @spec find_pets_by_status(Tesla.Env.client, list(String.t), keyword()) :: {:ok, nil} | {:ok, list(OpenapiPetstore.Model.Pet.t)} | {:error, Tesla.Env.t} def find_pets_by_status(connection, status, _opts \\ []) do @@ -109,7 +109,7 @@ defmodule OpenapiPetstore.Api.Pet do ## Returns {:ok, [%Pet{}, ...]} on success - {:error, info} on failure + {:error, Tesla.Env.t} on failure """ @spec find_pets_by_tags(Tesla.Env.client, list(String.t), keyword()) :: {:ok, nil} | {:ok, list(OpenapiPetstore.Model.Pet.t)} | {:error, Tesla.Env.t} def find_pets_by_tags(connection, tags, _opts \\ []) do @@ -136,8 +136,8 @@ defmodule OpenapiPetstore.Api.Pet do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %OpenapiPetstore.Model.Pet{}} on success - {:error, info} on failure + {:ok, OpenapiPetstore.Model.Pet.t} on success + {:error, Tesla.Env.t} on failure """ @spec get_pet_by_id(Tesla.Env.client, integer(), keyword()) :: {:ok, nil} | {:ok, OpenapiPetstore.Model.Pet.t} | {:error, Tesla.Env.t} def get_pet_by_id(connection, pet_id, _opts \\ []) do @@ -163,8 +163,8 @@ defmodule OpenapiPetstore.Api.Pet do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec update_pet(Tesla.Env.client, OpenapiPetstore.Model.Pet.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def update_pet(connection, body, _opts \\ []) do @@ -194,8 +194,8 @@ defmodule OpenapiPetstore.Api.Pet do - :status (String.t): Updated status of the pet ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec update_pet_with_form(Tesla.Env.client, integer(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def update_pet_with_form(connection, pet_id, opts \\ []) do @@ -226,8 +226,8 @@ defmodule OpenapiPetstore.Api.Pet do - :file (String.t): file to upload ## Returns - {:ok, %OpenapiPetstore.Model.ApiResponse{}} on success - {:error, info} on failure + {:ok, OpenapiPetstore.Model.ApiResponse.t} on success + {:error, Tesla.Env.t} on failure """ @spec upload_file(Tesla.Env.client, integer(), keyword()) :: {:ok, OpenapiPetstore.Model.ApiResponse.t} | {:error, Tesla.Env.t} def upload_file(connection, pet_id, opts \\ []) do @@ -258,8 +258,8 @@ defmodule OpenapiPetstore.Api.Pet do - :additional_metadata (String.t): Additional data to pass to server ## Returns - {:ok, %OpenapiPetstore.Model.ApiResponse{}} on success - {:error, info} on failure + {:ok, OpenapiPetstore.Model.ApiResponse.t} on success + {:error, Tesla.Env.t} on failure """ @spec upload_file_with_required_file(Tesla.Env.client, integer(), String.t, keyword()) :: {:ok, OpenapiPetstore.Model.ApiResponse.t} | {:error, Tesla.Env.t} def upload_file_with_required_file(connection, pet_id, required_file, opts \\ []) do diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/store.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/store.ex index a64c4bfe72a..d6f183ea193 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/store.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/store.ex @@ -22,8 +22,8 @@ defmodule OpenapiPetstore.Api.Store do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec delete_order(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def delete_order(connection, order_id, _opts \\ []) do @@ -49,7 +49,7 @@ defmodule OpenapiPetstore.Api.Store do ## Returns {:ok, %{}} on success - {:error, info} on failure + {:error, Tesla.Env.t} on failure """ @spec get_inventory(Tesla.Env.client, keyword()) :: {:ok, map()} | {:error, Tesla.Env.t} def get_inventory(connection, _opts \\ []) do @@ -74,8 +74,8 @@ defmodule OpenapiPetstore.Api.Store do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %OpenapiPetstore.Model.Order{}} on success - {:error, info} on failure + {:ok, OpenapiPetstore.Model.Order.t} on success + {:error, Tesla.Env.t} on failure """ @spec get_order_by_id(Tesla.Env.client, integer(), keyword()) :: {:ok, nil} | {:ok, OpenapiPetstore.Model.Order.t} | {:error, Tesla.Env.t} def get_order_by_id(connection, order_id, _opts \\ []) do @@ -101,8 +101,8 @@ defmodule OpenapiPetstore.Api.Store do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %OpenapiPetstore.Model.Order{}} on success - {:error, info} on failure + {:ok, OpenapiPetstore.Model.Order.t} on success + {:error, Tesla.Env.t} on failure """ @spec place_order(Tesla.Env.client, OpenapiPetstore.Model.Order.t, keyword()) :: {:ok, nil} | {:ok, OpenapiPetstore.Model.Order.t} | {:error, Tesla.Env.t} def place_order(connection, body, _opts \\ []) do diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/user.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/user.ex index a2acacce0ae..fd8c2d12ee0 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/user.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/user.ex @@ -22,8 +22,8 @@ defmodule OpenapiPetstore.Api.User do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec create_user(Tesla.Env.client, OpenapiPetstore.Model.User.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def create_user(connection, body, _opts \\ []) do @@ -44,12 +44,12 @@ defmodule OpenapiPetstore.Api.User do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body ([User]): List of user object + - body ([OpenapiPetstore.Model.User.t]): List of user object - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec create_users_with_array_input(Tesla.Env.client, list(OpenapiPetstore.Model.User.t), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def create_users_with_array_input(connection, body, _opts \\ []) do @@ -70,12 +70,12 @@ defmodule OpenapiPetstore.Api.User do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body ([User]): List of user object + - body ([OpenapiPetstore.Model.User.t]): List of user object - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec create_users_with_list_input(Tesla.Env.client, list(OpenapiPetstore.Model.User.t), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def create_users_with_list_input(connection, body, _opts \\ []) do @@ -101,8 +101,8 @@ defmodule OpenapiPetstore.Api.User do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec delete_user(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def delete_user(connection, username, _opts \\ []) do @@ -127,8 +127,8 @@ defmodule OpenapiPetstore.Api.User do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %OpenapiPetstore.Model.User{}} on success - {:error, info} on failure + {:ok, OpenapiPetstore.Model.User.t} on success + {:error, Tesla.Env.t} on failure """ @spec get_user_by_name(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, OpenapiPetstore.Model.User.t} | {:error, Tesla.Env.t} def get_user_by_name(connection, username, _opts \\ []) do @@ -155,8 +155,8 @@ defmodule OpenapiPetstore.Api.User do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %OpenapiPetstore.Model.String.t{}} on success - {:error, info} on failure + {:ok, String.t} on success + {:error, Tesla.Env.t} on failure """ @spec login_user(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, String.t} | {:error, Tesla.Env.t} def login_user(connection, username, password, _opts \\ []) do @@ -182,8 +182,8 @@ defmodule OpenapiPetstore.Api.User do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec logout_user(Tesla.Env.client, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def logout_user(connection, _opts \\ []) do @@ -209,8 +209,8 @@ defmodule OpenapiPetstore.Api.User do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, %{}} on success - {:error, info} on failure + {:ok, nil} on success + {:error, Tesla.Env.t} on failure """ @spec update_user(Tesla.Env.client, String.t, OpenapiPetstore.Model.User.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} def update_user(connection, username, body, _opts \\ []) do diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex index 08d6d28d82d..7f44693809d 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex @@ -28,12 +28,12 @@ defmodule OpenapiPetstore.Model.AdditionalPropertiesClass do :"map_integer" => %{optional(String.t) => integer()} | nil, :"map_boolean" => %{optional(String.t) => boolean()} | nil, :"map_array_integer" => %{optional(String.t) => [integer()]} | nil, - :"map_array_anytype" => %{optional(String.t) => [Map]} | nil, + :"map_array_anytype" => %{optional(String.t) => [map()]} | nil, :"map_map_string" => %{optional(String.t) => %{optional(String.t) => String.t}} | nil, - :"map_map_anytype" => %{optional(String.t) => %{optional(String.t) => Map}} | nil, - :"anytype_1" => Map | nil, - :"anytype_2" => Map | nil, - :"anytype_3" => Map | nil + :"map_map_anytype" => %{optional(String.t) => %{optional(String.t) => map()}} | nil, + :"anytype_1" => map() | nil, + :"anytype_2" => map() | nil, + :"anytype_3" => map() | nil } end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/array_test.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/array_test.ex index fbed2547c5e..ccf61c3b5c7 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/array_test.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/array_test.ex @@ -17,7 +17,7 @@ defmodule OpenapiPetstore.Model.ArrayTest do @type t :: %__MODULE__{ :"array_of_string" => [String.t] | nil, :"array_array_of_integer" => [[integer()]] | nil, - :"array_array_of_model" => [[ReadOnlyFirst]] | nil + :"array_array_of_model" => [[OpenapiPetstore.Model.ReadOnlyFirst.t]] | nil } end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex index 11e81c98a77..185067458fc 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex @@ -21,7 +21,7 @@ defmodule OpenapiPetstore.Model.EnumTest do :"enum_string_required" => String.t, :"enum_integer" => integer() | nil, :"enum_number" => float() | nil, - :"outerEnum" => OuterEnum | nil + :"outerEnum" => OpenapiPetstore.Model.OuterEnum.t | nil } end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/file_schema_test_class.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/file_schema_test_class.ex index 2c5031ca919..6c91069f9c9 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/file_schema_test_class.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/file_schema_test_class.ex @@ -14,8 +14,8 @@ defmodule OpenapiPetstore.Model.FileSchemaTestClass do ] @type t :: %__MODULE__{ - :"file" => File | nil, - :"files" => [File] | nil + :"file" => OpenapiPetstore.Model.File.t | nil, + :"files" => [OpenapiPetstore.Model.File.t] | nil } end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex index 5a54b558f3f..170a43ba194 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex @@ -48,7 +48,6 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.FormatTest do def decode(value, options) do value |> deserialize(:"date", :date, nil, options) - |> deserialize(:"BigDecimal", :struct, OpenapiPetstore.Model.String.t, options) end end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/mixed_properties_and_additional_properties_class.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/mixed_properties_and_additional_properties_class.ex index 3603ec4f6bb..c807226af27 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/mixed_properties_and_additional_properties_class.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/mixed_properties_and_additional_properties_class.ex @@ -17,7 +17,7 @@ defmodule OpenapiPetstore.Model.MixedPropertiesAndAdditionalPropertiesClass do @type t :: %__MODULE__{ :"uuid" => String.t | nil, :"dateTime" => DateTime.t | nil, - :"map" => %{optional(String.t) => Animal} | nil + :"map" => %{optional(String.t) => OpenapiPetstore.Model.Animal.t} | nil } end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/pet.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/pet.ex index 4fdcdc95a8e..a46e041dcb7 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/pet.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/pet.ex @@ -19,10 +19,10 @@ defmodule OpenapiPetstore.Model.Pet do @type t :: %__MODULE__{ :"id" => integer() | nil, - :"category" => Category | nil, + :"category" => OpenapiPetstore.Model.Category.t | nil, :"name" => String.t, :"photoUrls" => [String.t], - :"tags" => [Tag] | nil, + :"tags" => [OpenapiPetstore.Model.Tag.t] | nil, :"status" => String.t | nil } end From 8a955255b3f5b1c78e44fd0d741cb93d1491278c Mon Sep 17 00:00:00 2001 From: cal Date: Mon, 25 Jan 2021 10:34:52 +0100 Subject: [PATCH 32/54] erefactor - AutoRefactor - Collections.addAll() rather than loop (#8464) Collection related refactorings: - replaces for/foreach loops to use Collections.addAll() where possible, - replaces for/foreach loops to use Collection.addAll() where possible, - replaces for/foreach loops to use Collection.removeAll() where possible. AddAllRatherThanLoopCleanUp from AutoRefactor applied by erefactor. For AutoRefactor see https://github.com/JnRouvignac/AutoRefactor . --- .../codegen/languages/TypeScriptAngularClientCodegen.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java index e0d7c235a77..636091c6208 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java @@ -540,9 +540,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode for (String name : cm.imports) { if (name.indexOf(" | ") >= 0) { String[] parts = name.split(" \\| "); - for (String s : parts) { - newImports.add(s); - } + Collections.addAll(newImports, parts); } else { newImports.add(name); } From 4990dd6d8a22f8fdadb7ce82a34dd65df0ff5175 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 25 Jan 2021 17:54:04 +0800 Subject: [PATCH 33/54] remove windows batch script (#8526) --- bin/windows/typescript.bat | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100755 bin/windows/typescript.bat diff --git a/bin/windows/typescript.bat b/bin/windows/typescript.bat deleted file mode 100755 index 0e006951cf4..00000000000 --- a/bin/windows/typescript.bat +++ /dev/null @@ -1,22 +0,0 @@ -set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar - -If Not Exist %executable% ( - mvn clean package -) - -REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M - -set args=generate -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g typescript -o samples\openapi3\client\petstore\typescript\builds\default --additional-properties=platform=node,npmName=ts-petstore-client -java %JAVA_OPTS% -jar %executable% %args% - -args=generate -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g typescript -o samples\openapi3\client\petstore\typescript\builds\jquery --additional-properties=framework=jquery,npmName=ts-petstore-client -java %JAVA_OPTS% -jar %executable% %args% - -set args=generate -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g typescript -o samples\openapi3\client\petstore\typescript\builds\object_params --additional-properties=platform=node,npmName=ts-petstore-client,useObjectParameters -java %JAVA_OPTS% -jar %executable% %args% - -set args=generate -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g typescript -o samples\openapi3\client\petstore\typescript\builds\inversify --additional-properties=platform=node,npmName=ts-petstore-client,useInversify -java %JAVA_OPTS% -jar %executable% %args% - -set args=generate -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g typescript -o samples\openapi3\client\petstore\typescript\builds\deno --additional-properties=platform=deno -java %JAVA_OPTS% -jar %executable% %args% From bdfe3706f7e42683665c207252b0f6d242f0d99b Mon Sep 17 00:00:00 2001 From: kannkyo <15080890+kannkyo@users.noreply.github.com> Date: Mon, 25 Jan 2021 19:13:29 +0900 Subject: [PATCH 34/54] Support securityDefinitions (#8459) --- .../main/resources/jmeter-client/api.mustache | 27 ++++++++++++++-- samples/client/petstore/jmeter/PetApi.jmx | 32 +++++++++++++++++++ samples/client/petstore/jmeter/StoreApi.jmx | 4 +++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache b/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache index 02675582c10..60ec78c155d 100644 --- a/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache @@ -93,7 +93,23 @@ accept {{{mediaType}}} - {{/produces.0}} + {{/produces.0}}{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + + Authorization + Basic ${__P(basicBasicToken,token)} + {{/isBasicBasic}}{{#isBasicBearer}} + + Authorization + Bearer ${__P(basicBearerToken,token)} + {{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}{{#isKeyInHeader}} + + {{keyParamName}} + ${__P(apiKey,key)} + {{/isKeyInHeader}}{{/isApiKey}}{{#isOAuth}} + + {{keyParamName}} + Bearer ${__P(oathToken,token)} + {{/isOAuth}}{{/authMethods}} @@ -112,7 +128,14 @@ false {{=<% %>=}}${<% paramName %>}<%={{ }}=%> = - {{/bodyParam}} + {{/bodyParam}}{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}} + + false + ${__P(apiKey,key)} + = + true + {{keyParamName}} + {{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}} diff --git a/samples/client/petstore/jmeter/PetApi.jmx b/samples/client/petstore/jmeter/PetApi.jmx index 6624d24e38f..1bc21baf5eb 100644 --- a/samples/client/petstore/jmeter/PetApi.jmx +++ b/samples/client/petstore/jmeter/PetApi.jmx @@ -121,6 +121,10 @@ Content-Type application/json + + + Bearer ${__P(oathToken,token)} + @@ -197,6 +201,10 @@ apiKey ${__RandomString(10,qwertyuiopasdfghjklzxcvbnm)} + + + Bearer ${__P(oathToken,token)} + @@ -268,6 +276,10 @@ accept application/xml + + + Bearer ${__P(oathToken,token)} + @@ -346,6 +358,10 @@ accept application/xml + + + Bearer ${__P(oathToken,token)} + @@ -424,6 +440,10 @@ accept application/xml + + api_key + ${__P(apiKey,key)} + @@ -495,6 +515,10 @@ Content-Type application/json + + + Bearer ${__P(oathToken,token)} + @@ -571,6 +595,10 @@ Content-Type application/x-www-form-urlencoded + + + Bearer ${__P(oathToken,token)} + @@ -646,6 +674,10 @@ accept application/json + + + Bearer ${__P(oathToken,token)} + diff --git a/samples/client/petstore/jmeter/StoreApi.jmx b/samples/client/petstore/jmeter/StoreApi.jmx index 8113bd3c3ca..48a114769d1 100644 --- a/samples/client/petstore/jmeter/StoreApi.jmx +++ b/samples/client/petstore/jmeter/StoreApi.jmx @@ -168,6 +168,10 @@ accept application/json + + api_key + ${__P(apiKey,key)} + From c7a711697c6e258b88362a22fd64e9a532370ad3 Mon Sep 17 00:00:00 2001 From: kannkyo <15080890+kannkyo@users.noreply.github.com> Date: Mon, 25 Jan 2021 19:17:15 +0900 Subject: [PATCH 35/54] Support json data in csv (#8461) --- .../src/main/resources/jmeter-client/api.mustache | 2 +- samples/client/petstore/jmeter/PetApi.jmx | 4 ++-- samples/client/petstore/jmeter/StoreApi.jmx | 2 +- samples/client/petstore/jmeter/UserApi.jmx | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache b/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache index 60ec78c155d..1717071e100 100644 --- a/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache @@ -126,7 +126,7 @@ {{/queryParams}}{{#bodyParam}} false - {{=<% %>=}}${<% paramName %>}<%={{ }}=%> + {{=<% %>=}}${__javaScript("${<% paramName %>}".replace(/'/g\, '"'),)}<%={{ }}=%> = {{/bodyParam}}{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}} diff --git a/samples/client/petstore/jmeter/PetApi.jmx b/samples/client/petstore/jmeter/PetApi.jmx index 1bc21baf5eb..6fdef6ad04e 100644 --- a/samples/client/petstore/jmeter/PetApi.jmx +++ b/samples/client/petstore/jmeter/PetApi.jmx @@ -134,7 +134,7 @@ false - ${body} + ${__javaScript("${body}".replace(/'/g\, '"'),)} = @@ -528,7 +528,7 @@ false - ${body} + ${__javaScript("${body}".replace(/'/g\, '"'),)} = diff --git a/samples/client/petstore/jmeter/StoreApi.jmx b/samples/client/petstore/jmeter/StoreApi.jmx index 48a114769d1..6c10ea74074 100644 --- a/samples/client/petstore/jmeter/StoreApi.jmx +++ b/samples/client/petstore/jmeter/StoreApi.jmx @@ -323,7 +323,7 @@ false - ${body} + ${__javaScript("${body}".replace(/'/g\, '"'),)} = diff --git a/samples/client/petstore/jmeter/UserApi.jmx b/samples/client/petstore/jmeter/UserApi.jmx index 208580536e1..fc1ff67ed39 100644 --- a/samples/client/petstore/jmeter/UserApi.jmx +++ b/samples/client/petstore/jmeter/UserApi.jmx @@ -126,7 +126,7 @@ false - ${body} + ${__javaScript("${body}".replace(/'/g\, '"'),)} = @@ -198,7 +198,7 @@ false - ${body} + ${__javaScript("${body}".replace(/'/g\, '"'),)} = @@ -270,7 +270,7 @@ false - ${body} + ${__javaScript("${body}".replace(/'/g\, '"'),)} = @@ -632,7 +632,7 @@ false - ${body} + ${__javaScript("${body}".replace(/'/g\, '"'),)} = From 55a21bc4fb2eca9dcef2f50b1a6e93dccd4c4f62 Mon Sep 17 00:00:00 2001 From: Benjamin Klatt Date: Mon, 25 Jan 2021 11:19:14 +0100 Subject: [PATCH 36/54] viadee as using company (#8529) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cadd93acc9f..c270088a292 100644 --- a/README.md +++ b/README.md @@ -672,6 +672,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - [Vouchery.io](https://vouchery.io) - [Xero](https://www.xero.com/) - [Yahoo Japan](https://www.yahoo.co.jp/) +- [viadee](https://www.viadee.de/) - [Vonage](https://vonage.com) - [YITU Technology](https://www.yitutech.com/) - [Yelp](https://www.yelp.com/) From c55bee12734aa04fbcf03357773f444a67af2214 Mon Sep 17 00:00:00 2001 From: basyskom-dege <72982549+basyskom-dege@users.noreply.github.com> Date: Mon, 25 Jan 2021 11:26:47 +0100 Subject: [PATCH 37/54] [Qt][C++] Updated cpp-qt5-client doc (#8251) * Update cpp-qt5-client.md Added missing security feature support in the documentation * added missing security features in doc --- docs/generators/cpp-qt5-client.md | 6 +++--- .../openapitools/codegen/languages/CppQt5ClientCodegen.java | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/generators/cpp-qt5-client.md b/docs/generators/cpp-qt5-client.md index 557ea18b69b..ada59e68cea 100644 --- a/docs/generators/cpp-qt5-client.md +++ b/docs/generators/cpp-qt5-client.md @@ -232,10 +232,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl ### Security Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 -|BearerToken|✗|OAS3 +|BearerToken|✓|OAS3 |OAuth2_Implicit|✗|OAS2,OAS3 |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java index f0b8cfc957c..7a383a1e87e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java @@ -23,6 +23,7 @@ import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.meta.features.GlobalFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; import java.io.File; @@ -42,6 +43,9 @@ public class CppQt5ClientCodegen extends CppQt5AbstractCodegen implements Codege .includeDocumentationFeatures(DocumentationFeature.Readme) .includeGlobalFeatures(GlobalFeature.ParameterizedServer) .includeGlobalFeatures(GlobalFeature.MultiServer) + .includeSecurityFeatures(SecurityFeature.BasicAuth) + .includeSecurityFeatures(SecurityFeature.ApiKey) + .includeSecurityFeatures(SecurityFeature.BearerToken) ); // set the output folder here From 201acbd3dee392c01f48f9b961a2cfda586d26c0 Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Mon, 25 Jan 2021 11:31:19 +0100 Subject: [PATCH 38/54] [dart] Fix switch on enums not possible (#8512) All enum instances are `const` so `equals/hashCode` is not needed. Removing this allows to `switch/case` on enum instances. --- .../src/main/resources/dart2/enum.mustache | 7 ----- .../main/resources/dart2/enum_inline.mustache | 7 ----- .../petstore_client_lib/lib/model/order.dart | 7 ----- .../petstore_client_lib/lib/model/pet.dart | 7 ----- .../petstore_client_lib/lib/model/order.dart | 7 ----- .../petstore_client_lib/lib/model/pet.dart | 7 ----- .../lib/model/enum_arrays.dart | 14 ---------- .../lib/model/enum_class.dart | 7 ----- .../lib/model/enum_test.dart | 28 ------------------- .../lib/model/map_test.dart | 7 ----- .../lib/model/order.dart | 7 ----- .../lib/model/outer_enum.dart | 7 ----- .../lib/model/outer_enum_default_value.dart | 7 ----- .../lib/model/outer_enum_integer.dart | 7 ----- .../outer_enum_integer_default_value.dart | 7 ----- .../lib/model/pet.dart | 7 ----- 16 files changed, 140 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart2/enum.mustache b/modules/openapi-generator/src/main/resources/dart2/enum.mustache index 0af2b0a47fe..d3ba3f350a8 100644 --- a/modules/openapi-generator/src/main/resources/dart2/enum.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/enum.mustache @@ -6,13 +6,6 @@ class {{{classname}}} { /// The underlying value of this enum member. final {{{dataType}}} value; - @override - bool operator ==(Object other) => identical(this, other) || - other is {{{classname}}} && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value{{^isString}}.toString(){{/isString}}; diff --git a/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache index 7daf6dea1f7..7d6fbed5c4f 100644 --- a/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache @@ -6,13 +6,6 @@ class {{{classname}}}{{{enumName}}} { /// The underlying value of this enum member. final {{{dataType}}} value; - @override - bool operator ==(Object other) => identical(this, other) || - other is {{{classname}}}{{{enumName}}} && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value{{^isString}}.toString(){{/isString}}; diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart index 30d60e0120a..a7b01582664 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart @@ -125,13 +125,6 @@ class OrderStatusEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is OrderStatusEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart index daa1c561e47..edb8930c11d 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart @@ -125,13 +125,6 @@ class PetStatusEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is PetStatusEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart index 30d60e0120a..a7b01582664 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart @@ -125,13 +125,6 @@ class OrderStatusEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is OrderStatusEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart index daa1c561e47..edb8930c11d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart @@ -125,13 +125,6 @@ class PetStatusEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is PetStatusEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart index b79f23df362..f0e7b2417db 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart @@ -86,13 +86,6 @@ class EnumArraysJustSymbolEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is EnumArraysJustSymbolEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; @@ -159,13 +152,6 @@ class EnumArraysArrayEnumEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is EnumArraysArrayEnumEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart index 8e1e1eb2e9e..96647a37971 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_class.dart @@ -17,13 +17,6 @@ class EnumClass { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is EnumClass && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart index 371858d9ea6..a4503966408 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart @@ -140,13 +140,6 @@ class EnumTestEnumStringEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is EnumTestEnumStringEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; @@ -216,13 +209,6 @@ class EnumTestEnumStringRequiredEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is EnumTestEnumStringRequiredEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; @@ -292,13 +278,6 @@ class EnumTestEnumIntegerEnum { /// The underlying value of this enum member. final int value; - @override - bool operator ==(Object other) => identical(this, other) || - other is EnumTestEnumIntegerEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value.toString(); @@ -365,13 +344,6 @@ class EnumTestEnumNumberEnum { /// The underlying value of this enum member. final double value; - @override - bool operator ==(Object other) => identical(this, other) || - other is EnumTestEnumNumberEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value.toString(); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart index 2834ab2acf4..99d39e720f9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart @@ -112,13 +112,6 @@ class MapTestInnerEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is MapTestInnerEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart index 30d60e0120a..a7b01582664 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart @@ -125,13 +125,6 @@ class OrderStatusEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is OrderStatusEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart index a4494ede999..ce3f4c30a53 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum.dart @@ -17,13 +17,6 @@ class OuterEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is OuterEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart index 0eb08d128bc..8f6d40b7d1e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_default_value.dart @@ -17,13 +17,6 @@ class OuterEnumDefaultValue { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is OuterEnumDefaultValue && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart index 6bbe2dda1fc..751506326be 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer.dart @@ -17,13 +17,6 @@ class OuterEnumInteger { /// The underlying value of this enum member. final int value; - @override - bool operator ==(Object other) => identical(this, other) || - other is OuterEnumInteger && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value.toString(); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart index 5eac2105488..c5f52fc8047 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_enum_integer_default_value.dart @@ -17,13 +17,6 @@ class OuterEnumIntegerDefaultValue { /// The underlying value of this enum member. final int value; - @override - bool operator ==(Object other) => identical(this, other) || - other is OuterEnumIntegerDefaultValue && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value.toString(); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart index daa1c561e47..edb8930c11d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart @@ -125,13 +125,6 @@ class PetStatusEnum { /// The underlying value of this enum member. final String value; - @override - bool operator ==(Object other) => identical(this, other) || - other is PetStatusEnum && other.value == value; - - @override - int get hashCode => toString().hashCode; - @override String toString() => value; From ecf905681c7046241ca0d79426c9614cc27ac46f Mon Sep 17 00:00:00 2001 From: iyzana <16743652+iyzana@users.noreply.github.com> Date: Mon, 25 Jan 2021 11:55:26 +0100 Subject: [PATCH 39/54] Implement useAbstractionForFiles for webclient library (#7567) * implement useAbstractionForFiles for webclient library * update doc Co-authored-by: William Cheng --- .../Java/libraries/webclient/api.mustache | 4 +- .../libraries/webclient/api_test.mustache | 2 +- .../codegen/java/JavaClientCodegenTest.java | 44 +++++++++++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache index 83178188549..5fbef45db81 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache @@ -62,7 +62,7 @@ public class {{classname}} { * @see {{summary}} Documentation {{/externalDocs}} */ - public {{#returnType}}{{#isArray}}Flux<{{{returnBaseType}}}>{{/isArray}}{{^isArray}}Mono<{{{returnType}}}>{{/isArray}} {{/returnType}}{{^returnType}}Mono {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException { + public {{#returnType}}{{#isArray}}Flux<{{{returnBaseType}}}>{{/isArray}}{{^isArray}}Mono<{{{returnType}}}>{{/isArray}} {{/returnType}}{{^returnType}}Mono {{/returnType}}{{operationId}}({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException { Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}} {{#required}} @@ -109,7 +109,7 @@ public class {{classname}} { {{#formParams}} if ({{paramName}} != null) - formParams.add{{#collectionFormat}}All{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}new FileSystemResource({{paramName}}){{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream().map(FileSystemResource::new).collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}}); + formParams.add{{#collectionFormat}}All{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}{{#useAbstractionForFiles}}{{paramName}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}new FileSystemResource({{paramName}}){{/useAbstractionForFiles}}{{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream(){{^useAbstractionForFiles}}.map(FileSystemResource::new){{/useAbstractionForFiles}}.collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}}); {{/formParams}} {{/hasFormParams}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache index 301acf8f244..c2b491aedc1 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache @@ -31,7 +31,7 @@ public class {{classname}}Test { @Test public void {{operationId}}Test() { {{#allParams}} - {{{dataType}}} {{paramName}} = null; + {{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}} = null; {{/allParams}} {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#isArray}}.collectList().block(){{/isArray}}{{^isArray}}.block(){{/isArray}}; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index b92773b3163..994db37808c 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -1088,4 +1088,48 @@ public class JavaClientCodegenTest { output.deleteOnExit(); } + + /** + * See https://github.com/OpenAPITools/openapi-generator/issues/6715 + */ + @Test + public void testWebClientWithUseAbstractionForFiles() throws IOException { + + Map properties = new HashMap<>(); + properties.put(JavaClientCodegen.JAVA8_MODE, true); + properties.put(CodegenConstants.API_PACKAGE, "xyz.abcdef.api"); + properties.put(JavaClientCodegen.USE_ABSTRACTION_FOR_FILES, true); + + + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("java") + .setLibrary(JavaClientCodegen.WEBCLIENT) + .setAdditionalProperties(properties) + .setInputSpec("src/test/resources/3_0/form-multipart-binary-array.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + + DefaultGenerator generator = new DefaultGenerator(); + List files = generator.opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + + Path defaultApi = Paths.get(output + "/src/main/java/xyz/abcdef/api/MultipartApi.java"); + TestUtils.assertFileContains(defaultApi, + //multiple files + "multipartArray(java.util.Collection files)", + "formParams.addAll(\"files\", files.stream().collect(Collectors.toList()));", + + //mixed + "multipartMixed(org.springframework.core.io.AbstractResource file, MultipartMixedMarker marker)", + "formParams.add(\"file\", file);", + + //single file + "multipartSingle(org.springframework.core.io.AbstractResource file)", + "formParams.add(\"file\", file);" + ); + } } From 17bb3750c43eed1287cf410f352baa4d6b0fd889 Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@users.noreply.github.com> Date: Mon, 25 Jan 2021 12:53:42 +0000 Subject: [PATCH 40/54] [swift 5] fix objc integration (#8534) * [swift 5] fix objc integration * [swift 5] fix combine integration --- .../openapi-generator/src/main/resources/swift5/api.mustache | 2 +- .../src/main/resources/swift5/modelObject.mustache | 2 +- .../PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift | 2 +- .../PetstoreClient/Classes/OpenAPIs/Models/Category.swift | 2 +- .../PetstoreClient/Classes/OpenAPIs/Models/Pet.swift | 2 +- .../PetstoreClient/Classes/OpenAPIs/Models/Tag.swift | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift5/api.mustache b/modules/openapi-generator/src/main/resources/swift5/api.mustache index 29fe27d9f76..f1e181e2524 100644 --- a/modules/openapi-generator/src/main/resources/swift5/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/api.mustache @@ -142,10 +142,10 @@ extension {{projectName}}API { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> */ + #if canImport(Combine) {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> AnyPublisher<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> { return Future<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error>.init { promise in diff --git a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache index 36d1eb6e78b..661bb479b48 100644 --- a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache @@ -1,5 +1,5 @@ {{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct {{classname}}: Codable{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} { -{{/objcCompatible}}{{#objcCompatible}}@objc {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} { +{{/objcCompatible}}{{#objcCompatible}}@objc {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable { {{/objcCompatible}} {{#allVars}} diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 5e27397f6fd..b4226ff4aa1 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -186,8 +186,8 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher<[Pet], Error> */ - @available(*, deprecated, message: "This operation is deprecated.") #if canImport(Combine) + @available(*, deprecated, message: "This operation is deprecated.") @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[Pet], Error> { return Future<[Pet], Error>.init { promise in diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index a69d5c26afd..0e034abbf72 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -@objc public class Category: NSObject, Codable, Hashable { +@objc public class Category: NSObject, Codable { public var _id: Int64? public var _idNum: NSNumber? { diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index b38ff2e23a7..e17ada14c42 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -@objc public class Pet: NSObject, Codable, Hashable { +@objc public class Pet: NSObject, Codable { public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index d3aefb0946c..fc02765d30e 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -@objc public class Tag: NSObject, Codable, Hashable { +@objc public class Tag: NSObject, Codable { public var _id: Int64? public var _idNum: NSNumber? { From a127aab497807f2ba02f9eaed8a0e5f0182ff252 Mon Sep 17 00:00:00 2001 From: SBNTT Date: Tue, 26 Jan 2021 02:50:16 +0100 Subject: [PATCH 41/54] --http-user-agent arg support in javascript generator (#8531) * add User-Agent header in Javascript generator * add User-Agent header in Javascript-apollo generator * update samples --- .../src/main/resources/Javascript-Apollo/api.mustache | 3 ++- .../src/main/resources/Javascript/es6/ApiClient.mustache | 4 +++- samples/client/petstore/javascript-es6/src/ApiClient.js | 4 +++- .../client/petstore/javascript-promise-es6/src/ApiClient.js | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Javascript-Apollo/api.mustache b/modules/openapi-generator/src/main/resources/Javascript-Apollo/api.mustache index 87b27a51ad9..63cb101aadb 100644 --- a/modules/openapi-generator/src/main/resources/Javascript-Apollo/api.mustache +++ b/modules/openapi-generator/src/main/resources/Javascript-Apollo/api.mustache @@ -53,7 +53,8 @@ export default class <&classname> extends ApiClient { let queryParams = {<#queryParams> '': <#collectionFormat>this.buildCollectionParam(<#required><^required>opts[''], '')<^collectionFormat><#required><^required>opts['']<^-last>, }; - let headerParams = {<#headerParams> + let headerParams = { + 'User-Agent': '<#httpUserAgent><.><^httpUserAgent>OpenAPI-Generator/<&projectVersion>/Javascript',<#headerParams> '': <#required><^required>opts['']<^-last>, }; let formParams = {<#formParams> diff --git a/modules/openapi-generator/src/main/resources/Javascript/es6/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Javascript/es6/ApiClient.mustache index c356fd6f45e..a226cfc08aa 100644 --- a/modules/openapi-generator/src/main/resources/Javascript/es6/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Javascript/es6/ApiClient.mustache @@ -52,7 +52,9 @@ class ApiClient { * @type {Array.} * @default {} */{{/emitJSDoc}} - this.defaultHeaders = {}; + this.defaultHeaders = { + 'User-Agent': '{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{projectVersion}}/Javascript{{/httpUserAgent}}' + }; /** * The default HTTP timeout for all API calls. diff --git a/samples/client/petstore/javascript-es6/src/ApiClient.js b/samples/client/petstore/javascript-es6/src/ApiClient.js index 4a73394c094..dffe9dda22f 100644 --- a/samples/client/petstore/javascript-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-es6/src/ApiClient.js @@ -53,7 +53,9 @@ class ApiClient { * @type {Array.} * @default {} */ - this.defaultHeaders = {}; + this.defaultHeaders = { + 'User-Agent': 'OpenAPI-Generator/1.0.0/Javascript' + }; /** * The default HTTP timeout for all API calls. diff --git a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js index d5d9e1a7230..c1143615624 100644 --- a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js @@ -53,7 +53,9 @@ class ApiClient { * @type {Array.} * @default {} */ - this.defaultHeaders = {}; + this.defaultHeaders = { + 'User-Agent': 'OpenAPI-Generator/1.0.0/Javascript' + }; /** * The default HTTP timeout for all API calls. From 0ae54911c39b84190622fd3e5285ebf3ebe76841 Mon Sep 17 00:00:00 2001 From: Michael Ramstein <633688+mrmstn@users.noreply.github.com> Date: Tue, 26 Jan 2021 03:25:21 +0100 Subject: [PATCH 42/54] [Elixir] Adds workaround for httpc for post/put/patch requests (#5682) * Ensures empty body is always present for post/put/patch * Generate samples --- .../languages/ElixirClientCodegen.java | 17 ++++++++++++++ .../src/main/resources/elixir/api.mustache | 3 +++ .../elixir/request_builder.ex.mustache | 22 +++++++++++++++++++ .../elixir/lib/openapi_petstore/api/fake.ex | 5 +++++ .../elixir/lib/openapi_petstore/api/pet.ex | 2 ++ .../lib/openapi_petstore/request_builder.ex | 22 +++++++++++++++++++ 6 files changed, 71 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java index 9ef6e2a5656..5d1da614223 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java @@ -818,6 +818,23 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig sb.append(".t"); } } + + private boolean getRequiresHttpcWorkaround() { + // Only POST/PATCH/PUT are affected from the httpc bug + if (!(this.httpMethod.equals("POST") || this.httpMethod.equals("PATCH") || this.httpMethod.equals("PUT"))) { + return false; + } + + // If theres something required for the body, the workaround is not required + for (CodegenParameter requiredParam : this.requiredParams) { + if (requiredParam.isBodyParam || requiredParam.isFormParam) { + return false; + } + } + + // In case there is nothing for the body, the operation requires the workaround + return true; + } } class ExtendedCodegenModel extends CodegenModel { diff --git a/modules/openapi-generator/src/main/resources/elixir/api.mustache b/modules/openapi-generator/src/main/resources/elixir/api.mustache index ad3155fc2f2..7979112f560 100644 --- a/modules/openapi-generator/src/main/resources/elixir/api.mustache +++ b/modules/openapi-generator/src/main/resources/elixir/api.mustache @@ -67,6 +67,9 @@ defmodule {{moduleName}}.Api.{{classname}} do |> add_optional_params(optional_params, opts) {{/-first}} {{/optionalParams}} +{{#requiresHttpcWorkaround}} + |> ensure_body() +{{/requiresHttpcWorkaround}} |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response({{#responses}}{{#-first}}[ diff --git a/modules/openapi-generator/src/main/resources/elixir/request_builder.ex.mustache b/modules/openapi-generator/src/main/resources/elixir/request_builder.ex.mustache index 1345cf78928..70e6fe297cd 100644 --- a/modules/openapi-generator/src/main/resources/elixir/request_builder.ex.mustache +++ b/modules/openapi-generator/src/main/resources/elixir/request_builder.ex.mustache @@ -102,6 +102,28 @@ defmodule {{moduleName}}.RequestBuilder do Map.update(request, location, [{key, value}], &(&1 ++ [{key, value}])) end + @doc """ + Due to a bug in httpc, POST, PATCH and PUT requests will fail, if the body is empty + + This function will ensure, that the body param is always set + + ## Parameters + + - request (Map) - Collected request options + + ## Returns + + Map + """ + @spec ensure_body(map()) :: map() + def ensure_body(%{body: nil} = request) do + %{request | body: ""} + end + + def ensure_body(request) do + Map.put_new(request, :body, "") + end + @doc """ Handle the response for a Tesla request diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex index bd336856c78..e43ebc24caa 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex @@ -60,6 +60,7 @@ defmodule OpenapiPetstore.Api.Fake do |> method(:post) |> url("/fake/outer/boolean") |> add_optional_params(optional_params, opts) + |> ensure_body() |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -89,6 +90,7 @@ defmodule OpenapiPetstore.Api.Fake do |> method(:post) |> url("/fake/outer/composite") |> add_optional_params(optional_params, opts) + |> ensure_body() |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -118,6 +120,7 @@ defmodule OpenapiPetstore.Api.Fake do |> method(:post) |> url("/fake/outer/number") |> add_optional_params(optional_params, opts) + |> ensure_body() |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -147,6 +150,7 @@ defmodule OpenapiPetstore.Api.Fake do |> method(:post) |> url("/fake/outer/string") |> add_optional_params(optional_params, opts) + |> ensure_body() |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -457,6 +461,7 @@ defmodule OpenapiPetstore.Api.Fake do |> add_param(:query, :"http", http) |> add_param(:query, :"url", url) |> add_param(:query, :"context", context) + |> ensure_body() |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex index 98802f5c2eb..b6a42cd7b90 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex @@ -207,6 +207,7 @@ defmodule OpenapiPetstore.Api.Pet do |> method(:post) |> url("/pet/#{pet_id}") |> add_optional_params(optional_params, opts) + |> ensure_body() |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -239,6 +240,7 @@ defmodule OpenapiPetstore.Api.Pet do |> method(:post) |> url("/pet/#{pet_id}/uploadImage") |> add_optional_params(optional_params, opts) + |> ensure_body() |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/request_builder.ex b/samples/client/petstore/elixir/lib/openapi_petstore/request_builder.ex index 3a062d61a16..2488ab80c75 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/request_builder.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/request_builder.ex @@ -105,6 +105,28 @@ defmodule OpenapiPetstore.RequestBuilder do Map.update(request, location, [{key, value}], &(&1 ++ [{key, value}])) end + @doc """ + Due to a bug in httpc, POST, PATCH and PUT requests will fail, if the body is empty + + This function will ensure, that the body param is always set + + ## Parameters + + - request (Map) - Collected request options + + ## Returns + + Map + """ + @spec ensure_body(map()) :: map() + def ensure_body(%{body: nil} = request) do + %{request | body: ""} + end + + def ensure_body(request) do + Map.put_new(request, :body, "") + end + @doc """ Handle the response for a Tesla request From 84813be309f789a21cbff45f2bcf35bd90ec43cf Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 26 Jan 2021 10:27:09 +0800 Subject: [PATCH 43/54] remove supportJava6 option (#8514) --- docs/generators/java.md | 3 +- .../codegen/languages/JavaClientCodegen.java | 3 +- .../src/main/resources/Java/README.mustache | 2 +- .../main/resources/Java/build.gradle.mustache | 12 ------- .../google-api-client/build.gradle.mustache | 12 ------- .../libraries/google-api-client/pom.mustache | 11 ------- .../Java/libraries/jersey2/ApiClient.mustache | 17 ---------- .../libraries/jersey2/build.gradle.mustache | 23 ------------- .../Java/libraries/jersey2/build.sbt.mustache | 14 +++----- .../Java/libraries/jersey2/model.mustache | 5 --- .../Java/libraries/jersey2/pojo.mustache | 25 --------------- .../Java/libraries/jersey2/pom.mustache | 32 ------------------- .../libraries/okhttp-gson/README.mustache | 2 +- .../okhttp-gson/build.gradle.mustache | 12 ------- .../Java/libraries/okhttp-gson/pom.mustache | 2 +- .../libraries/resteasy/ApiClient.mustache | 6 ---- .../libraries/resteasy/build.gradle.mustache | 20 ------------ .../libraries/resteasy/build.sbt.mustache | 4 --- .../Java/libraries/resteasy/pom.mustache | 28 ---------------- .../resttemplate/build.gradle.mustache | 12 ------- .../Java/libraries/resttemplate/pom.mustache | 6 ---- .../libraries/retrofit/build.gradle.mustache | 6 ---- .../Java/libraries/retrofit/pom.mustache | 11 ------- .../libraries/retrofit2/build.gradle.mustache | 12 ------- .../retrofit2/play24/ApiClient.mustache | 8 ++--- .../retrofit2/play25/ApiClient.mustache | 8 ++--- .../Java/libraries/retrofit2/pom.mustache | 13 +------- .../Java/libraries/vertx/pom.mustache | 5 --- .../libraries/webclient/build.gradle.mustache | 12 ------- .../src/main/resources/Java/model.mustache | 5 --- .../src/main/resources/Java/pojo.mustache | 25 --------------- .../src/main/resources/Java/pom.mustache | 27 ---------------- .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../model/AdditionalPropertiesAnyType.java | 1 - .../model/AdditionalPropertiesArray.java | 1 - .../model/AdditionalPropertiesBoolean.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../model/AdditionalPropertiesInteger.java | 1 - .../model/AdditionalPropertiesNumber.java | 1 - .../model/AdditionalPropertiesObject.java | 1 - .../model/AdditionalPropertiesString.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/BigCat.java | 1 - .../client/model/BigCatAllOf.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TypeHolderDefault.java | 1 - .../client/model/TypeHolderExample.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../openapitools/client/model/XmlItem.java | 1 - .../client/model/ChildSchema.java | 1 - .../client/model/ChildSchemaAllOf.java | 1 - .../client/model/MySchemaNameCharacters.java | 1 - .../model/MySchemaNameCharactersAllOf.java | 1 - .../org/openapitools/client/model/Parent.java | 1 - .../model/AdditionalPropertiesClass.java | 1 - .../org/openapitools/client/model/Animal.java | 1 - .../org/openapitools/client/model/Apple.java | 1 - .../openapitools/client/model/AppleReq.java | 1 - .../model/ArrayOfArrayOfNumberOnly.java | 1 - .../client/model/ArrayOfNumberOnly.java | 1 - .../openapitools/client/model/ArrayTest.java | 1 - .../org/openapitools/client/model/Banana.java | 1 - .../openapitools/client/model/BananaReq.java | 1 - .../openapitools/client/model/BasquePig.java | 1 - .../client/model/Capitalization.java | 1 - .../org/openapitools/client/model/Cat.java | 1 - .../openapitools/client/model/CatAllOf.java | 1 - .../openapitools/client/model/Category.java | 1 - .../openapitools/client/model/ChildCat.java | 1 - .../client/model/ChildCatAllOf.java | 1 - .../openapitools/client/model/ClassModel.java | 1 - .../org/openapitools/client/model/Client.java | 1 - .../client/model/ComplexQuadrilateral.java | 1 - .../openapitools/client/model/DanishPig.java | 1 - .../org/openapitools/client/model/Dog.java | 1 - .../openapitools/client/model/DogAllOf.java | 1 - .../openapitools/client/model/Drawing.java | 1 - .../openapitools/client/model/EnumArrays.java | 1 - .../openapitools/client/model/EnumTest.java | 1 - .../client/model/EquilateralTriangle.java | 1 - .../client/model/FileSchemaTestClass.java | 1 - .../org/openapitools/client/model/Foo.java | 1 - .../openapitools/client/model/FormatTest.java | 1 - .../client/model/GrandparentAnimal.java | 1 - .../client/model/HasOnlyReadOnly.java | 1 - .../client/model/HealthCheckResult.java | 1 - .../client/model/InlineResponseDefault.java | 1 - .../client/model/IsoscelesTriangle.java | 1 - .../openapitools/client/model/MapTest.java | 1 - ...ropertiesAndAdditionalPropertiesClass.java | 1 - .../client/model/Model200Response.java | 1 - .../client/model/ModelApiResponse.java | 1 - .../client/model/ModelReturn.java | 1 - .../org/openapitools/client/model/Name.java | 1 - .../client/model/NullableClass.java | 1 - .../openapitools/client/model/NumberOnly.java | 1 - .../org/openapitools/client/model/Order.java | 1 - .../client/model/OuterComposite.java | 1 - .../openapitools/client/model/ParentPet.java | 1 - .../org/openapitools/client/model/Pet.java | 1 - .../client/model/QuadrilateralInterface.java | 1 - .../client/model/ReadOnlyFirst.java | 1 - .../client/model/ScaleneTriangle.java | 1 - .../client/model/ShapeInterface.java | 1 - .../client/model/SimpleQuadrilateral.java | 1 - .../client/model/SpecialModelName.java | 1 - .../org/openapitools/client/model/Tag.java | 1 - .../client/model/TriangleInterface.java | 1 - .../org/openapitools/client/model/User.java | 1 - .../org/openapitools/client/model/Whale.java | 1 - .../org/openapitools/client/model/Zebra.java | 1 - 974 files changed, 19 insertions(+), 1306 deletions(-) diff --git a/docs/generators/java.md b/docs/generators/java.md index 819129bc1fa..38c3f19f56a 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -35,7 +35,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |invokerPackage|root package for generated code| |org.openapitools.client| |java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
    **true**
    Use Java 8 classes such as Base64
    **false**
    Various third party libraries as needed
    |true| |legacyDiscriminatorBehavior|Set to true for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
    **true**
    The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
    **false**
    The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
    |true| -|library|library template (sub-template) to use|
    **jersey1**
    HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.
    **jersey2**
    HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
    **feign**
    HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.
    **okhttp-gson**
    [DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
    **retrofit2**
    HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)
    **resttemplate**
    HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x
    **webclient**
    HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x
    **resteasy**
    HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x
    **vertx**
    HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
    **google-api-client**
    HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
    **rest-assured**
    HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8
    **native**
    HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
    **microprofile**
    HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x
    |okhttp-gson| +|library|library template (sub-template) to use|
    **jersey1**
    HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.
    **jersey2**
    HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
    **feign**
    HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.
    **okhttp-gson**
    [DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
    **retrofit2**
    HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)
    **resttemplate**
    HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x
    **webclient**
    HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x
    **resteasy**
    HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x
    **vertx**
    HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
    **google-api-client**
    HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
    **rest-assured**
    HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8
    **native**
    HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
    **microprofile**
    HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x
    |okhttp-gson| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null| @@ -57,7 +57,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sourceFolder|source folder for generated code| |src/main/java| -|supportJava6|Whether to support Java6 with the Jersey1 library. This option has been deprecated and will be removed in the 5.x release| |false| |useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate library| |false| |useBeanValidation|Use BeanValidation API annotations| |false| |useGzipFeature|Send gzip-encoded requests| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index ce2c5a61180..3dd6dddbf69 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -142,7 +142,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(PARCELABLE_MODEL, "Whether to generate models for Android that implement Parcelable with the okhttp-gson library.")); cliOptions.add(CliOption.newBoolean(USE_PLAY_WS, "Use Play! Async HTTP client (Play WS API)")); cliOptions.add(CliOption.newString(PLAY_VERSION, "Version of Play! Framework (possible values \"play24\" (Deprecated), \"play25\" (Deprecated), \"play26\" (Default))")); - cliOptions.add(CliOption.newBoolean(SUPPORT_JAVA6, "Whether to support Java6 with the Jersey1 library. This option has been deprecated and will be removed in the 5.x release")); cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations")); cliOptions.add(CliOption.newBoolean(PERFORM_BEANVALIDATION, "Perform BeanValidation")); cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Send gzip-encoded requests")); @@ -154,7 +153,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on " + RESTTEMPLATE + " library")); cliOptions.add(CliOption.newBoolean(DYNAMIC_OPERATIONS, "Generate operations dynamically at runtime from an OAS", this.dynamicOperations)); - supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead."); + supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead."); supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x"); supportedLibraries.put(FEIGN, "HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x."); supportedLibraries.put(OKHTTP_GSON, "[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); diff --git a/modules/openapi-generator/src/main/resources/Java/README.mustache b/modules/openapi-generator/src/main/resources/Java/README.mustache index 40d272ed318..fd9abd28241 100644 --- a/modules/openapi-generator/src/main/resources/Java/README.mustache +++ b/modules/openapi-generator/src/main/resources/Java/README.mustache @@ -20,7 +20,7 @@ Building the API client library requires: -1. Java {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}}+ +1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ 2. Maven/Gradle ## Installation diff --git a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache index 0982932dfb0..a14862d3a81 100644 --- a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache @@ -34,11 +34,6 @@ if(hasProperty('target') && target == 'android') { } compileOptions { - {{#supportJava6}} - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -47,7 +42,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} } // Rename the aar correctly @@ -92,11 +86,6 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - {{#supportJava6}} - sourceCompatibility = JavaVersion.VERSION_1_6 - targetCompatibility = JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -105,7 +94,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache index 496ff42fcce..14d93d588dc 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache @@ -33,11 +33,6 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 22 } compileOptions { - {{#supportJava6}} - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -46,7 +41,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} } // Rename the aar correctly @@ -91,11 +85,6 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - {{#supportJava6}} - sourceCompatibility = JavaVersion.VERSION_1_6 - targetCompatibility = JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -104,7 +93,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache index 17a87a012d4..3a4b62e203b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache @@ -144,11 +144,6 @@ maven-compiler-plugin 3.6.1 - {{#supportJava6}} - 1.6 - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -157,7 +152,6 @@ 1.7 1.7 {{/java8}} - {{/supportJava6}} @@ -166,17 +160,12 @@ 3.1.1 none - {{#supportJava6}} - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 {{/java8}} {{^java8}} 1.7 {{/java8}} - {{/supportJava6}} 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 e8833c12611..69727cd0ace 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 @@ -34,15 +34,9 @@ import java.security.cert.X509Certificate; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; -{{^supportJava6}} import java.nio.file.Files; import java.nio.file.StandardCopyOption; import org.glassfish.jersey.logging.LoggingFeature; -{{/supportJava6}} -{{#supportJava6}} -import org.apache.commons.io.FileUtils; -import org.glassfish.jersey.filter.LoggingFilter; -{{/supportJava6}} import java.util.logging.Level; import java.util.logging.Logger; import java.util.Collection; @@ -997,13 +991,7 @@ public class ApiClient{{#java8}} extends JavaTimeFormatter{{/java8}} { public File downloadFileFromResponse(Response response) throws ApiException { try { File file = prepareDownloadFile(response); -{{^supportJava6}} Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING); -{{/supportJava6}} -{{#supportJava6}} - // Java6 falls back to commons.io for file copying - FileUtils.copyToFile(response.readEntity(InputStream.class), file); -{{/supportJava6}} return file; } catch (IOException e) { throw new ApiException(e); @@ -1259,15 +1247,10 @@ public class ApiClient{{#java8}} extends JavaTimeFormatter{{/java8}} { // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); if (debugging) { -{{^supportJava6}} clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); // Set logger to ALL java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL); -{{/supportJava6}} -{{#supportJava6}} - clientConfig.register(new LoggingFilter(java.util.logging.Logger.getLogger(LoggingFilter.class.getName()), true)); -{{/supportJava6}} } else { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache index 9292d599cad..a15919fb9bb 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache @@ -33,11 +33,6 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - {{#supportJava6}} - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -46,7 +41,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} } // Rename the aar correctly @@ -90,11 +84,6 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - {{#supportJava6}} - sourceCompatibility = JavaVersion.VERSION_1_6 - targetCompatibility = JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -103,7 +92,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} install { repositories.mavenInstaller { @@ -124,14 +112,7 @@ ext { {{#openApiNullable}} jackson_databind_nullable_version = "0.2.1" {{/openApiNullable}} - {{#supportJava6}} - jersey_version = "2.6" - commons_io_version=2.5 - commons_lang3_version=3.6 - {{/supportJava6}} - {{^supportJava6}} jersey_version = "2.27" - {{/supportJava6}} junit_version = "4.13.1" {{#threetenbp}} threetenbp_version = "2.9.10" @@ -170,10 +151,6 @@ dependencies { {{#hasHttpSignatureMethods}} implementation "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version" {{/hasHttpSignatureMethods}} - {{#supportJava6}} - implementation "commons-io:commons-io:$commons_io_version" - implementation "org.apache.commons:commons-lang3:$commons_lang3_version" - {{/supportJava6}} {{#threetenbp}} implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" {{/threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache index 42afc6016ba..52f17959a63 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache @@ -10,11 +10,11 @@ lazy val root = (project in file(".")). resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( "io.swagger" % "swagger-annotations" % "1.5.22", - "org.glassfish.jersey.core" % "jersey-client" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.27"{{/supportJava6}},{{^supportJava6}} - "org.glassfish.jersey.inject" % "jersey-hk2" % "2.27",{{/supportJava6}} - "org.glassfish.jersey.media" % "jersey-media-multipart" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.27"{{/supportJava6}}, - "org.glassfish.jersey.media" % "jersey-media-json-jackson" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.27"{{/supportJava6}}, - "org.glassfish.jersey.connectors" % "jersey-apache-connector" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.27"{{/supportJava6}}, + "org.glassfish.jersey.core" % "jersey-client" % "2.27", + "org.glassfish.jersey.inject" % "jersey-hk2" % "2.27", + "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.27", + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.27", + "org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.27", "com.fasterxml.jackson.core" % "jackson-core" % "2.10.4" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.4" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.4" % "compile", @@ -36,10 +36,6 @@ lazy val root = (project in file(".")). {{^java8}} "com.brsanthu" % "migbase64" % "2.2", {{/java8}} - {{#supportJava6}} - "org.apache.commons" % "commons-lang3" % "3.6", - "commons-io" % "commons-io" % "2.5", - {{/supportJava6}} "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", "junit" % "junit" % "4.13.1" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/model.mustache index c0664be10de..18ee1211785 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/model.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/model.mustache @@ -16,15 +16,10 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; {{/additionalPropertiesType}} {{/model}} {{/models}} -{{^supportJava6}} import java.util.Objects; import java.util.Arrays; import java.util.Map; import java.util.HashMap; -{{/supportJava6}} -{{#supportJava6}} -import org.apache.commons.lang3.ObjectUtils; -{{/supportJava6}} {{#imports}} import {{import}}; {{/imports}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache index 3d1c6cf59db..70fadd299bc 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache @@ -251,7 +251,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{/vars}} {{>libraries/jersey2/additional_properties}} -{{^supportJava6}} /** * Return true if this {{name}} object is equal to o. */ @@ -286,30 +285,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{/useReflectionEqualsHashCode}} } -{{/supportJava6}} -{{#supportJava6}} - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - }{{#hasVars}} - {{classname}} {{classVarName}} = ({{classname}}) o; - return {{#vars}}ObjectUtils.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} && - {{/-last}}{{/vars}}{{#parent}} && - super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} - return true;{{/hasVars}} - } - - @Override - public int hashCode() { - return ObjectUtils.hashCodeMulti({{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); - } - -{{/supportJava6}} - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache index 293356545b0..e7765a50d1b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache @@ -145,11 +145,6 @@ maven-compiler-plugin 3.8.1 - {{#supportJava6}} - 1.6 - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -158,7 +153,6 @@ 1.7 1.7 {{/java8}} - {{/supportJava6}} true 128m 512m @@ -182,17 +176,12 @@ none - {{#supportJava6}} - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 {{/java8}} {{^java8}} 1.7 {{/java8}} - {{/supportJava6}} http.response.details @@ -262,13 +251,11 @@ jersey-client ${jersey-version} - {{^supportJava6}} org.glassfish.jersey.inject jersey-hk2 ${jersey-version} - {{/supportJava6}} org.glassfish.jersey.media jersey-media-multipart @@ -340,18 +327,6 @@ 2.2 {{/java8}} - {{#supportJava6}} - - org.apache.commons - commons-lang3 - ${commons-lang3-version} - - - commons-io - commons-io - ${commons-io-version} - - {{/supportJava6}} {{#hasHttpSignatureMethods}} org.tomitribe @@ -397,14 +372,7 @@ UTF-8 1.6.1 - {{^supportJava6}} 2.30.1 - {{/supportJava6}} - {{#supportJava6}} - 2.6 - 2.5 - 3.6 - {{/supportJava6}} 2.10.4 2.10.4 0.2.1 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache index 6da087078f0..5b4ff7e38f5 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache @@ -18,7 +18,7 @@ ## Requirements Building the API client library requires: -1. Java {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}}+ +1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ 2. Maven/Gradle ## Installation diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache index 104fe6d0ff1..c027064edd4 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache @@ -40,11 +40,6 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - {{#supportJava6}} - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -53,7 +48,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} } // Rename the aar correctly @@ -98,11 +92,6 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - {{#supportJava6}} - sourceCompatibility = JavaVersion.VERSION_1_6 - targetCompatibility = JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -111,7 +100,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index 598312cad6c..d99f278244e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -327,7 +327,7 @@ - {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}} + {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} ${java.version} ${java.version} 1.8.4 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/ApiClient.mustache index 8f3486eb5db..a4489c1e8d1 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/ApiClient.mustache @@ -560,13 +560,7 @@ public class ApiClient{{#java8}} extends JavaTimeFormatter{{/java8}} { public File downloadFileFromResponse(Response response) throws ApiException { try { File file = prepareDownloadFile(response); -{{^supportJava6}} Files.copy(response.readEntity(InputStream.class), file.toPath()); -{{/supportJava6}} -{{#supportJava6}} - // Java6 falls back to commons.io for file copying - FileUtils.copyToFile(response.readEntity(InputStream.class), file); -{{/supportJava6}} return file; } catch (IOException e) { throw new ApiException(e); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache index ed3020519df..3823153acc7 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache @@ -33,11 +33,6 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 23 } compileOptions { - {{#supportJava6}} - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -46,7 +41,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} } // Rename the aar correctly @@ -90,11 +84,6 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - {{#supportJava6}} - sourceCompatibility = JavaVersion.VERSION_1_6 - targetCompatibility = JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -103,7 +92,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} install { repositories.mavenInstaller { @@ -129,10 +117,6 @@ ext { {{^java8}} jodatime_version = "2.9.9" {{/java8}} - {{#supportJava6}} - commons_io_version=2.5 - commons_lang3_version=3.5 - {{/supportJava6}} junit_version = "4.13" } @@ -157,10 +141,6 @@ dependencies { implementation "joda-time:joda-time:$jodatime_version" implementation "com.brsanthu:migbase64:2.2" {{/java8}} - {{#supportJava6}} - implementation "commons-io:commons-io:$commons_io_version" - implementation "org.apache.commons:commons-lang3:$commons_lang3_version" - {{/supportJava6}} implementation 'javax.annotation:javax.annotation-api:1.3.2' testImplementation "junit:junit:$junit_version" } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache index 721e4620057..79600b7754c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache @@ -25,10 +25,6 @@ lazy val root = (project in file(".")). "joda-time" % "joda-time" % "2.9.9" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", {{/java8}} - {{#supportJava6}} - "org.apache.commons" % "commons-lang3" % "3.5" % "compile", - "commons-io" % "commons-io" % "2.5" % "compile", - {{/supportJava6}} "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", "junit" % "junit" % "4.13" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache index 738f438da60..82c5a036087 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache @@ -142,11 +142,6 @@ maven-compiler-plugin 2.5.1 - {{#supportJava6}} - 1.6 - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -155,7 +150,6 @@ 1.7 1.7 {{/java8}} - {{/supportJava6}} @@ -164,17 +158,12 @@ 3.1.1 none - {{#supportJava6}} - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 {{/java8}} {{^java8}} 1.7 {{/java8}} - {{/supportJava6}} @@ -263,19 +252,6 @@ {{/java8}} - {{#supportJava6}} - - org.apache.commons - commons-lang3 - ${commons_lang3_version} - - - - commons-io - commons-io - ${commons_io_version} - - {{/supportJava6}} org.jboss.resteasy resteasy-jackson2-provider @@ -317,10 +293,6 @@ {{^java8}} 2.9.9 {{/java8}} - {{#supportJava6}} - 2.5 - 3.6 - {{/supportJava6}} 1.0.0 4.13 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache index d41aa90de15..11235a89bb7 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache @@ -33,11 +33,6 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 22 } compileOptions { - {{#supportJava6}} - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -46,7 +41,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} } // Rename the aar correctly @@ -91,11 +85,6 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - {{#supportJava6}} - sourceCompatibility = JavaVersion.VERSION_1_6 - targetCompatibility = JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -104,7 +93,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache index 2fdd99cf76f..ca273093471 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache @@ -144,11 +144,6 @@ maven-compiler-plugin 3.6.1 - {{#supportJava6}} - 1.6 - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -157,7 +152,6 @@ 1.7 1.7 {{/java8}} - {{/supportJava6}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache index cd1096e5723..ec85f6ec71b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache @@ -33,11 +33,6 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - {{#supportJava6}} - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -46,7 +41,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} } // Rename the aar correctly diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache index d2d5bf60249..b495864db77 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache @@ -144,11 +144,6 @@ maven-compiler-plugin 3.6.1 - {{#supportJava6}} - 1.6 - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -157,7 +152,6 @@ 1.7 1.7 {{/java8}} - {{/supportJava6}} @@ -166,17 +160,12 @@ 3.1.1 none - {{#supportJava6}} - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 {{/java8}} {{^java8}} 1.7 {{/java8}} - {{/supportJava6}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index 517d6a4e844..2bb2fb35613 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -33,11 +33,6 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - {{#supportJava6}} - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -46,7 +41,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} } // Rename the aar correctly @@ -91,11 +85,6 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - {{#supportJava6}} - sourceCompatibility = JavaVersion.VERSION_1_6 - targetCompatibility = JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -104,7 +93,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play24/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play24/ApiClient.mustache index a80cefc31dc..c43f800a42c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play24/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play24/ApiClient.mustache @@ -44,7 +44,7 @@ public class ApiClient { public ApiClient() { // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap<{{#supportJava6}}String, Authentication{{/supportJava6}}>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + authentications = new HashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} // authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} @@ -62,9 +62,9 @@ public class ApiClient { basePath = basePath + "/"; } - Map extraHeaders = new HashMap<{{#supportJava6}}String, String{{/supportJava6}}>(); - Map extraCookies = new HashMap<{{#supportJava6}}String, String{{/supportJava6}}>(); - List extraQueryParams = new ArrayList<{{#supportJava6}}Pair{{/supportJava6}}>(); + Map extraHeaders = new HashMap<>(); + Map extraCookies = new HashMap<>(); + List extraQueryParams = new ArrayList<>(); for (String authName : authentications.keySet()) { Authentication auth = authentications.get(authName); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play25/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play25/ApiClient.mustache index dcb9e2c58e0..849e0665e8c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play25/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play25/ApiClient.mustache @@ -44,7 +44,7 @@ public class ApiClient { public ApiClient() { // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap<{{#supportJava6}}String, Authentication{{/supportJava6}}>();{{#authMethods}}{{#isBasic}} + authentications = new HashMap<>();{{#authMethods}}{{#isBasic}} // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"query"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} // authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} @@ -61,9 +61,9 @@ public class ApiClient { basePath = basePath + "/"; } - Map extraHeaders = new HashMap<{{#supportJava6}}String, String{{/supportJava6}}>(); - Map extraCookies = new HashMap<{{#supportJava6}}String, String{{/supportJava6}}>(); - List extraQueryParams = new ArrayList<{{#supportJava6}}Pair{{/supportJava6}}>(); + Map extraHeaders = new HashMap<>(); + Map extraCookies = new HashMap<>(); + List extraQueryParams = new ArrayList<>(); for (String authName : authentications.keySet()) { Authentication auth = authentications.get(authName); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache index 7cb390987b3..32d395bf02e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache @@ -144,11 +144,6 @@ maven-compiler-plugin 3.6.1 - {{#supportJava6}} - 1.6 - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -157,7 +152,6 @@ 1.7 1.7 {{/java8}} - {{/supportJava6}} @@ -166,17 +160,12 @@ 3.1.1 none - {{#supportJava6}} - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 {{/java8}} {{^java8}} 1.7 {{/java8}} - {{/supportJava6}} @@ -414,7 +403,7 @@ UTF-8 - {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}} + {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} ${java.version} ${java.version} 1.8.3 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache index d9882a1866c..b4064662a98 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache @@ -154,17 +154,12 @@ 3.1.1 none - {{#supportJava6}} - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 {{/java8}} {{^java8}} 1.7 {{/java8}} - {{/supportJava6}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache index 028d9e5cc51..c892d189243 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache @@ -34,11 +34,6 @@ if(hasProperty('target') && target == 'android') { } compileOptions { - {{#supportJava6}} - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -47,7 +42,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} } // Rename the aar correctly @@ -92,11 +86,6 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - {{#supportJava6}} - sourceCompatibility = JavaVersion.VERSION_1_6 - targetCompatibility = JavaVersion.VERSION_1_6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -105,7 +94,6 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - {{/supportJava6}} install { repositories.mavenInstaller { diff --git a/modules/openapi-generator/src/main/resources/Java/model.mustache b/modules/openapi-generator/src/main/resources/Java/model.mustache index d4d1447a1d4..dec0b7dc8ac 100644 --- a/modules/openapi-generator/src/main/resources/Java/model.mustache +++ b/modules/openapi-generator/src/main/resources/Java/model.mustache @@ -6,13 +6,8 @@ package {{package}}; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; {{/useReflectionEqualsHashCode}} -{{^supportJava6}} import java.util.Objects; import java.util.Arrays; -{{/supportJava6}} -{{#supportJava6}} -import org.apache.commons.lang3.ObjectUtils; -{{/supportJava6}} {{#imports}} import {{import}}; {{/imports}} diff --git a/modules/openapi-generator/src/main/resources/Java/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/pojo.mustache index 03cf219b760..81eeb24af08 100644 --- a/modules/openapi-generator/src/main/resources/Java/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pojo.mustache @@ -228,7 +228,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{/vars}} -{{^supportJava6}} @Override public boolean equals(Object o) { {{#useReflectionEqualsHashCode}} @@ -259,30 +258,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE {{/useReflectionEqualsHashCode}} } -{{/supportJava6}} -{{#supportJava6}} - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - }{{#hasVars}} - {{classname}} {{classVarName}} = ({{classname}}) o; - return {{#vars}}ObjectUtils.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} && - {{/-last}}{{/vars}}{{#parent}} && - super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} - return true;{{/hasVars}} - } - - @Override - public int hashCode() { - return ObjectUtils.hashCodeMulti({{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); - } - -{{/supportJava6}} - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/modules/openapi-generator/src/main/resources/Java/pom.mustache b/modules/openapi-generator/src/main/resources/Java/pom.mustache index 75b0e9ef5c6..efe442bef78 100644 --- a/modules/openapi-generator/src/main/resources/Java/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pom.mustache @@ -159,11 +159,6 @@ maven-compiler-plugin 3.6.1 - {{#supportJava6}} - 1.6 - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 1.8 @@ -172,7 +167,6 @@ 1.7 1.7 {{/java8}} - {{/supportJava6}} @@ -181,17 +175,12 @@ 3.1.1 none - {{#supportJava6}} - 1.6 - {{/supportJava6}} - {{^supportJava6}} {{#java8}} 1.8 {{/java8}} {{^java8}} 1.7 {{/java8}} - {{/supportJava6}} @@ -329,18 +318,6 @@ 2.2 {{/java8}} - {{#supportJava6}} - - org.apache.commons - commons-lang3 - ${commons_lang3_version} - - - commons-io - commons-io - ${commons_io_version} - - {{/supportJava6}} {{#useBeanValidation}} @@ -385,10 +362,6 @@ UTF-8 1.5.21 1.19.4 - {{#supportJava6}} - 2.5 - 3.6 - {{/supportJava6}} 2.10.3 {{#threetenbp}} 2.9.10 diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 35291f77588..a8dd7c58542 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 5eff7572b0d..f7fcf4a291b 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -84,7 +84,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index d597dd1630b..99a88cd1581 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index e5d48f8135e..e83db349660 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -448,7 +448,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index ff79c51f577..f1dd62e5c74 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index 0cb4fd19e2c..aff8f783078 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -84,7 +84,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 607e3047e1c..0c6a900ce28 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 4286945ddac..6333987f289 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Animal.java index 2a5284c7716..1bb1c9298a3 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Animal.java @@ -121,7 +121,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 475b8f3b19d..a2ea07d623b 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -91,7 +91,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b94aa84873c..5609a835fd8 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -91,7 +91,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java index 371ead4207d..5a9e42b6d93 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -167,7 +167,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/BigCat.java index 11ce6fe9c09..03ff293e401 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/BigCat.java @@ -126,7 +126,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/BigCatAllOf.java index d82d3df41e8..3cef5febef3 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -119,7 +119,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Capitalization.java index 3ca37a5e47c..ef186a2e97c 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Capitalization.java @@ -230,7 +230,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Cat.java index 6cec9d1b43f..cca206467ad 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Cat.java @@ -91,7 +91,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/CatAllOf.java index cf5823325de..f0cdb0f6159 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -80,7 +80,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Category.java index 1467fa503e6..359a9f4a243 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Category.java @@ -109,7 +109,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ClassModel.java index 40588ad2b81..41569c56c9c 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ClassModel.java @@ -81,7 +81,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Client.java index bbc7b5c9758..38c477e8c1e 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Client.java @@ -80,7 +80,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Dog.java index 889c1e027a3..43a9f588029 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Dog.java @@ -87,7 +87,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/DogAllOf.java index f60b056ec92..bbdcbc1aae5 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -80,7 +80,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java index c58efb04291..e059f49ecf6 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -190,7 +190,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumTest.java index 683c8324ef2..3e36db5c091 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/EnumTest.java @@ -344,7 +344,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 956d66a44ea..39b06092102 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -120,7 +120,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FormatTest.java index 065ce291ef0..10032cbed10 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/FormatTest.java @@ -481,7 +481,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 5ee6e2cce6a..914a835ad26 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -92,7 +92,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java index b8002359f63..46d5b280791 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java @@ -240,7 +240,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 838311fb01b..fbbebaac921 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -154,7 +154,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Model200Response.java index 7cd85a2f2f4..b870f8b54b5 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Model200Response.java @@ -111,7 +111,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 672705a3ff3..bbadab2fa59 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -140,7 +140,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ModelReturn.java index 63dda6b56fd..67594de5d36 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -81,7 +81,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Name.java index 36fd65abcfd..cb3b9b79da2 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Name.java @@ -152,7 +152,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/NumberOnly.java index ba38e9ded85..7b6c81ff914 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -81,7 +81,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Order.java index e4da62890a7..fbed4fcc01d 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Order.java @@ -268,7 +268,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/OuterComposite.java index 19e4f97a067..c530d9042e8 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -141,7 +141,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Pet.java index 5080f9b0a78..437e50270da 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Pet.java @@ -284,7 +284,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 968b338e1b1..5a9f090b3d5 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -101,7 +101,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/SpecialModelName.java index adae4f49b52..40b1a7473c5 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -80,7 +80,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Tag.java index 386811f1beb..217878aaf6a 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/Tag.java @@ -110,7 +110,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index c07109fea75..584ea0d2a83 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -203,7 +203,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java index b4eaa509eee..bd3f9d00254 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -232,7 +232,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/User.java index 1a67b413f66..015e03770e5 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/User.java @@ -290,7 +290,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java index af4c426b8f8..129b988ca29 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java @@ -995,7 +995,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 497124467a2..366143d1fc0 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index d638cd95bf4..7a5e9587e65 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 5ce0e7937f5..8f017af3507 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index dca8ec41b68..e442eea3121 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -447,7 +447,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e7f70c5fb0d..8e85dd20fe7 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index e96cab6e53e..50db851ff00 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index fb48dd0c264..b6fcfc25ba8 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 932cfecb044..20bbfd1117d 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java index 6f15310fd8c..c33e153c751 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java @@ -120,7 +120,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 27ce18d552d..459f4602965 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b6d3b256a24..8becb8dd2b0 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java index 38399bfe582..8747730a9dd 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -166,7 +166,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCat.java index c000e826f31..ccfdc5a5ec0 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCat.java @@ -125,7 +125,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 81a5b56ed64..481e22e0df1 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -118,7 +118,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Capitalization.java index 27d2258b3fa..2065be194db 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Capitalization.java @@ -229,7 +229,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java index ad865f0c4b0..9c3291beecf 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java @@ -90,7 +90,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/CatAllOf.java index d3d7c8341d7..2199b085d73 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -79,7 +79,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java index ddd999f84c6..3737dbb3c3e 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Category.java @@ -108,7 +108,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ClassModel.java index 3e2216e6ae4..227bdaae556 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ClassModel.java @@ -80,7 +80,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Client.java index 2147430592b..9fea8958838 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Client.java @@ -79,7 +79,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java index 559b170c4f7..d54ac1b7a2f 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java @@ -86,7 +86,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/DogAllOf.java index 9f3d303c1ab..449c4e6f051 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -79,7 +79,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java index c38d53553cb..4944b28bdfe 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -189,7 +189,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumTest.java index bc6ce93c566..7589d69aa6d 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/EnumTest.java @@ -343,7 +343,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index f427cf921f6..074b99080e7 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -119,7 +119,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FormatTest.java index 23f3e20db17..5f8a894641d 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FormatTest.java @@ -480,7 +480,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index bd976488179..4f7e8a75ca2 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -91,7 +91,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java index 1271533e5be..b5921775cfd 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MapTest.java @@ -239,7 +239,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index fdb9393a657..dbb1682a919 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -153,7 +153,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Model200Response.java index 6bba2623f4b..bc3bee0e09a 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Model200Response.java @@ -110,7 +110,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 97921db1707..47f88db907b 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -139,7 +139,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelReturn.java index f28c2ac46ea..1b2a532f60c 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -80,7 +80,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Name.java index 7ba7d886ce2..1da9e1433c1 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Name.java @@ -151,7 +151,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NumberOnly.java index 54be0a4cbf0..d1f21fa5942 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -80,7 +80,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Order.java index 57d7e53a1c3..8d739749902 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Order.java @@ -267,7 +267,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/OuterComposite.java index 0275e5ed9b8..7b28063ef12 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -140,7 +140,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java index 2ac06b78334..fca1a5141de 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Pet.java @@ -283,7 +283,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 455300cd7f8..f866409c5bd 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -100,7 +100,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/SpecialModelName.java index ac1bfcbd846..2a7c39ec8e8 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -79,7 +79,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Tag.java index a95f8f4a4d8..9630d272242 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Tag.java @@ -109,7 +109,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 4dabcf030cc..6f0a0c91e1b 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -202,7 +202,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 1c18b7dc99f..1e3eb75f97b 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -231,7 +231,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/User.java index 49ed08dff9a..ba6825df44e 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/User.java @@ -289,7 +289,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java index 0b968d7136a..4fd920eb0fb 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/XmlItem.java @@ -994,7 +994,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 497124467a2..366143d1fc0 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index d638cd95bf4..7a5e9587e65 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 5ce0e7937f5..8f017af3507 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index dca8ec41b68..e442eea3121 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -447,7 +447,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e7f70c5fb0d..8e85dd20fe7 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index e96cab6e53e..50db851ff00 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index fb48dd0c264..b6fcfc25ba8 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 932cfecb044..20bbfd1117d 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java index 6f15310fd8c..c33e153c751 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java @@ -120,7 +120,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 27ce18d552d..459f4602965 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b6d3b256a24..8becb8dd2b0 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayTest.java index 38399bfe582..8747730a9dd 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -166,7 +166,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCat.java index c000e826f31..ccfdc5a5ec0 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCat.java @@ -125,7 +125,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 81a5b56ed64..481e22e0df1 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -118,7 +118,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Capitalization.java index 27d2258b3fa..2065be194db 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Capitalization.java @@ -229,7 +229,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Cat.java index d04c3ecd1a5..10d8036c414 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Cat.java @@ -90,7 +90,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/CatAllOf.java index 153873956c9..38910bf5c69 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -79,7 +79,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java index ddd999f84c6..3737dbb3c3e 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java @@ -108,7 +108,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ClassModel.java index 3e2216e6ae4..227bdaae556 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ClassModel.java @@ -80,7 +80,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Client.java index 2147430592b..9fea8958838 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Client.java @@ -79,7 +79,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Dog.java index 559b170c4f7..d54ac1b7a2f 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Dog.java @@ -86,7 +86,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/DogAllOf.java index 9f3d303c1ab..449c4e6f051 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -79,7 +79,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java index c38d53553cb..4944b28bdfe 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -189,7 +189,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumTest.java index bc6ce93c566..7589d69aa6d 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumTest.java @@ -343,7 +343,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index f427cf921f6..074b99080e7 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -119,7 +119,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FormatTest.java index 23f3e20db17..5f8a894641d 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FormatTest.java @@ -480,7 +480,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index bd976488179..4f7e8a75ca2 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -91,7 +91,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java index 1271533e5be..b5921775cfd 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java @@ -239,7 +239,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index fdb9393a657..dbb1682a919 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -153,7 +153,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Model200Response.java index 6bba2623f4b..bc3bee0e09a 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Model200Response.java @@ -110,7 +110,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 97921db1707..47f88db907b 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -139,7 +139,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelReturn.java index f28c2ac46ea..1b2a532f60c 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -80,7 +80,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Name.java index 7ba7d886ce2..1da9e1433c1 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Name.java @@ -151,7 +151,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/NumberOnly.java index 54be0a4cbf0..d1f21fa5942 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -80,7 +80,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Order.java index a8396385767..ef256856406 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Order.java @@ -267,7 +267,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/OuterComposite.java index bfea026235e..32db00927cb 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -140,7 +140,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java index 2ac06b78334..fca1a5141de 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java @@ -283,7 +283,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 455300cd7f8..f866409c5bd 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -100,7 +100,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/SpecialModelName.java index ac1bfcbd846..2a7c39ec8e8 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -79,7 +79,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Tag.java index a95f8f4a4d8..9630d272242 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Tag.java @@ -109,7 +109,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 53bf7905e15..5e13ac4ab73 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -202,7 +202,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 68fa374847d..7b89d392f5e 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -231,7 +231,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/User.java index 49ed08dff9a..ba6825df44e 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/User.java @@ -289,7 +289,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/XmlItem.java index 1067826b0d5..1a621d2e710 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/XmlItem.java @@ -994,7 +994,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 497124467a2..366143d1fc0 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index d638cd95bf4..7a5e9587e65 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 5ce0e7937f5..8f017af3507 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index dca8ec41b68..e442eea3121 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -447,7 +447,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e7f70c5fb0d..8e85dd20fe7 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index e96cab6e53e..50db851ff00 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index fb48dd0c264..b6fcfc25ba8 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 932cfecb044..20bbfd1117d 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java index 6f15310fd8c..c33e153c751 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java @@ -120,7 +120,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 27ce18d552d..459f4602965 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b6d3b256a24..8becb8dd2b0 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayTest.java index 38399bfe582..8747730a9dd 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -166,7 +166,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCat.java index c000e826f31..ccfdc5a5ec0 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCat.java @@ -125,7 +125,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 81a5b56ed64..481e22e0df1 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -118,7 +118,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Capitalization.java index 27d2258b3fa..2065be194db 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Capitalization.java @@ -229,7 +229,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Cat.java index d04c3ecd1a5..10d8036c414 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Cat.java @@ -90,7 +90,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/CatAllOf.java index 153873956c9..38910bf5c69 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -79,7 +79,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java index ddd999f84c6..3737dbb3c3e 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java @@ -108,7 +108,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ClassModel.java index 3e2216e6ae4..227bdaae556 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ClassModel.java @@ -80,7 +80,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Client.java index 2147430592b..9fea8958838 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Client.java @@ -79,7 +79,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Dog.java index 559b170c4f7..d54ac1b7a2f 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Dog.java @@ -86,7 +86,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/DogAllOf.java index 9f3d303c1ab..449c4e6f051 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -79,7 +79,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java index c38d53553cb..4944b28bdfe 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -189,7 +189,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumTest.java index bc6ce93c566..7589d69aa6d 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumTest.java @@ -343,7 +343,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index f427cf921f6..074b99080e7 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -119,7 +119,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FormatTest.java index 23f3e20db17..5f8a894641d 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FormatTest.java @@ -480,7 +480,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index bd976488179..4f7e8a75ca2 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -91,7 +91,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java index 1271533e5be..b5921775cfd 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java @@ -239,7 +239,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index fdb9393a657..dbb1682a919 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -153,7 +153,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Model200Response.java index 6bba2623f4b..bc3bee0e09a 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Model200Response.java @@ -110,7 +110,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 97921db1707..47f88db907b 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -139,7 +139,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelReturn.java index f28c2ac46ea..1b2a532f60c 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -80,7 +80,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Name.java index 7ba7d886ce2..1da9e1433c1 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Name.java @@ -151,7 +151,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/NumberOnly.java index 54be0a4cbf0..d1f21fa5942 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -80,7 +80,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Order.java index a8396385767..ef256856406 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Order.java @@ -267,7 +267,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/OuterComposite.java index bfea026235e..32db00927cb 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -140,7 +140,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java index 2ac06b78334..fca1a5141de 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java @@ -283,7 +283,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 455300cd7f8..f866409c5bd 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -100,7 +100,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/SpecialModelName.java index ac1bfcbd846..2a7c39ec8e8 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -79,7 +79,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Tag.java index a95f8f4a4d8..9630d272242 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Tag.java @@ -109,7 +109,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 53bf7905e15..5e13ac4ab73 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -202,7 +202,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 68fa374847d..7b89d392f5e 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -231,7 +231,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/User.java index 49ed08dff9a..ba6825df44e 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/User.java @@ -289,7 +289,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/XmlItem.java index 1067826b0d5..1a621d2e710 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/XmlItem.java @@ -994,7 +994,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 740de102c29..3a706ce98a6 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -126,7 +126,6 @@ public class AdditionalPropertiesAnyType { return Objects.hash(name, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 7985dee01f1..f95cac6fed2 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -127,7 +127,6 @@ public class AdditionalPropertiesArray { return Objects.hash(name, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 86651dbdbff..07fd09b9ba5 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -126,7 +126,6 @@ public class AdditionalPropertiesBoolean { return Objects.hash(name, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 0e6c3466c4a..7f70d66a225 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -442,7 +442,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index 296cea62414..bb3cc4c137e 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -126,7 +126,6 @@ public class AdditionalPropertiesInteger { return Objects.hash(name, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index a4995cfe4d1..615fc444024 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -127,7 +127,6 @@ public class AdditionalPropertiesNumber { return Objects.hash(name, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 4fedc69e241..3d831e6773d 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -127,7 +127,6 @@ public class AdditionalPropertiesObject { return Objects.hash(name, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 633081f6c49..2d575cb6d7e 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -126,7 +126,6 @@ public class AdditionalPropertiesString { return Objects.hash(name, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java index be20ac938ce..c24cbfda1a7 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java @@ -124,7 +124,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 61e776b5a47..9e5c4c6492f 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -95,7 +95,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 57efee4d2d1..45fd7829c9e 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -95,7 +95,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java index d903e38a4c1..db796d93d47 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -169,7 +169,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCat.java index 44ea5765415..ccccfb60e3a 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCat.java @@ -130,7 +130,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCatAllOf.java index e0015b42cb9..015fe219045 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -123,7 +123,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java index a9dea7ecdf0..e368f955e7d 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java @@ -229,7 +229,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java index 69c4c5e4314..46cf35becd4 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java @@ -95,7 +95,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java index 03f58bfd5b1..54e6b24cdb0 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -84,7 +84,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java index ee4737e8d35..ea4ceb96ec0 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java @@ -112,7 +112,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java index c8ae7f8a76e..700ba2f17b7 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java @@ -85,7 +85,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java index dab78b57cd5..e7c0e00398d 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java @@ -84,7 +84,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java index db448c6c57b..e7e9d204f85 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java @@ -91,7 +91,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java index a9c704f742e..086058c0a71 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -84,7 +84,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java index 7dca4022c01..3ec9f891572 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -193,7 +193,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java index c48a00dd28b..c58502ef21d 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java @@ -344,7 +344,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index accd424c2af..c60d469c297 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -123,7 +123,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java index 87fd7af0b49..acaafa9d535 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java @@ -472,7 +472,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index c97c586db81..7bba0219b1c 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -97,7 +97,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java index f1cc1f76952..82b45777945 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java @@ -241,7 +241,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 11744f59e90..1391207e425 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -156,7 +156,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java index 8dc189bc731..6f8ab9af771 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java @@ -114,7 +114,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 6526672a02e..6fca2b9dcb6 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -142,7 +142,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java index a70aae4ecd8..00ca2754808 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -85,7 +85,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java index 6654394f0f9..40e242f6aba 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java @@ -155,7 +155,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java index ccc4d7f9696..bfb345fc28f 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -85,7 +85,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java index c23472d7675..6db255687ba 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java @@ -267,7 +267,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java index 86250c03b98..f1425c4a848 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -143,7 +143,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java index 8de9e4e212d..8d7d3414dab 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java @@ -283,7 +283,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index e3a4e82ff20..22495675ccb 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -105,7 +105,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java index 73b3d0ffc48..c3ecc1b7916 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -84,7 +84,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java index 58d7e848629..9080c1b7b20 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java @@ -113,7 +113,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 06012d611e1..612dc13ba92 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -203,7 +203,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 7e615c2ea63..a2e72e41cf3 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -231,7 +231,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java index 36a8c958c88..dfa70476af3 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java @@ -287,7 +287,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/XmlItem.java index 0bd142f494b..c5c0b271502 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/XmlItem.java @@ -971,7 +971,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index f79a901b71d..acb0175c213 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 3a728a76023..90e9afca2f0 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -78,7 +78,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 2bd69aca4ab..f6e70331f6e 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 077571ff8df..0495881506d 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -422,7 +422,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e38eb418615..208dfdbc15f 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index ba5b2b9b2cf..b008b847a7e 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -78,7 +78,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 4a236c28685..c2ce3b2fbe2 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index fa11b0dc474..dcecf6e69dd 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java index 6ba2cfafee7..67e9a14d06e 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java @@ -107,7 +107,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index fbc5067ee70..7e3ba8195c7 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -85,7 +85,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 72f6fee00ff..279edaea8a7 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -85,7 +85,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java index 4c9e81e8468..b1bfac1da86 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -157,7 +157,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java index 6fa51b1bde4..ee503f76942 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java @@ -131,7 +131,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 99b2714b1b4..a6bdb2bbe3f 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -125,7 +125,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java index a18fd8ffdb0..42909659d9c 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java @@ -214,7 +214,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java index a3a7ba7eba7..19705043a2f 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java @@ -81,7 +81,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/CatAllOf.java index eede69dd633..6be8b4534b1 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -74,7 +74,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java index e19b0174656..bc1672714e2 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java @@ -101,7 +101,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java index 29fd53f9c88..f43b881b90c 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java @@ -75,7 +75,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java index 4a40b04cd47..1702dbadd88 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java @@ -74,7 +74,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java index 02bd48cfa5e..5c80057e78e 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java @@ -80,7 +80,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java index c76faa74e38..9e311a1f6af 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -74,7 +74,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java index 0ff5e9216ff..9a9c2f1a59a 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -206,7 +206,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java index 49527493f6a..7f325519f9b 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java @@ -378,7 +378,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 40a72877e62..a6c4008d1e9 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -112,7 +112,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java index b5e841ec1d9..7809f39132a 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java @@ -449,7 +449,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 6b4d1f20626..7f915754ffa 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -84,7 +84,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java index 94379fa3137..f8fedfcde0c 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java @@ -240,7 +240,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index ced17913313..0c225d1f6cd 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -144,7 +144,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java index e5e0c759fc9..f11d9e5d570 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java @@ -103,7 +103,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java index ef176e1bd10..595d829ad8d 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -130,7 +130,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java index ea05ccfecde..dc27972cb67 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -75,7 +75,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java index b424973a4f8..48241077590 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java @@ -140,7 +140,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java index 9b1accdea88..172856aaf7a 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -75,7 +75,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java index 02cc2736b7f..34b170e3ecd 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java @@ -264,7 +264,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java index 9b933ccfa26..32829a45215 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -131,7 +131,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java index 079cf4e54fc..cdc15037c15 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java @@ -280,7 +280,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 061e70f8951..23ca124c518 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -93,7 +93,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java index b597f67abe6..ffd53c78dee 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -74,7 +74,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java index f6d6fbaf2c6..f34a659e794 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java @@ -102,7 +102,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 911e309fd86..5586c8e6a82 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -189,7 +189,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2b2985f15d4..0d6f48c11ea 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -216,7 +216,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java index ea8fb75113a..86d4751120a 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java @@ -270,7 +270,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java index 3bd9a883c57..a09ec289d51 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java @@ -933,7 +933,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index a13fc98ec82..8817e7d1ac9 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesAnyType extends HashMap impleme return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index d784e0ca721..0565a50bd4f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesArray extends HashMap implements return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index e44d751debb..92290427d32 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesBoolean extends HashMap implem return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 8de35356fdd..a310ccb549d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -426,7 +426,6 @@ public class AdditionalPropertiesClass implements Parcelable { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index fdbe11cac79..e73be2717a8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesInteger extends HashMap implem return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index f8cab5ec5b6..3a7693d9cd5 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesNumber extends HashMap impl return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 56c71a6a9ed..929ee8601ad 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesObject extends HashMap implements return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 390a9ebd743..0f752ea3d58 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesString extends HashMap implemen return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java index c4d1f9b70a1..5e7660d0258 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java @@ -109,7 +109,6 @@ public class Animal implements Parcelable { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 130c21c2bed..6af2a91abfe 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -89,7 +89,6 @@ public class ArrayOfArrayOfNumberOnly implements Parcelable { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 30853ddef9c..1751cd7e672 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -89,7 +89,6 @@ public class ArrayOfNumberOnly implements Parcelable { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java index 02e3c16dc07..366791bcb79 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -161,7 +161,6 @@ public class ArrayTest implements Parcelable { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java index b3bfe4db44c..c2da68b7d26 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java @@ -134,7 +134,6 @@ public class BigCat extends Cat implements Parcelable { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java index c3f3dc8a3b3..1ed766c1e78 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -129,7 +129,6 @@ public class BigCatAllOf implements Parcelable { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java index bfe3ff75cb5..48a61ddc2d2 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java @@ -218,7 +218,6 @@ public class Capitalization implements Parcelable { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java index d6b5706842e..ef9c0e620a0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java @@ -84,7 +84,6 @@ public class Cat extends Animal implements Parcelable { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java index f6bf94ab8bb..26415a2d8c4 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -78,7 +78,6 @@ public class CatAllOf implements Parcelable { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java index ff45f7a9f74..48a16637cfa 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java @@ -105,7 +105,6 @@ public class Category implements Parcelable { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java index 3da89295c1d..4bee921b00d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java @@ -79,7 +79,6 @@ public class ClassModel implements Parcelable { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java index b3dcf5f42fc..9a8db7cfb77 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java @@ -78,7 +78,6 @@ public class Client implements Parcelable { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java index fee3a8d69ba..9e9f2f09a32 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java @@ -83,7 +83,6 @@ public class Dog extends Animal implements Parcelable { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java index 67827960399..d931385d39b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -78,7 +78,6 @@ public class DogAllOf implements Parcelable { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java index 868faf2ecd4..60a12b75f6e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -210,7 +210,6 @@ public class EnumArrays implements Parcelable { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java index 6d4158f0d1a..da3d7683421 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java @@ -382,7 +382,6 @@ public class EnumTest implements Parcelable { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index ec96d3a7a7b..d526b21a8ac 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -116,7 +116,6 @@ public class FileSchemaTestClass implements Parcelable { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java index 6386fce4e3a..c091e5f903e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java @@ -453,7 +453,6 @@ public class FormatTest implements Parcelable { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index dd1898652d6..f6346371be2 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -88,7 +88,6 @@ public class HasOnlyReadOnly implements Parcelable { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java index bcba119dd25..bbdeb5ea44e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java @@ -244,7 +244,6 @@ public class MapTest implements Parcelable { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 008238543f8..f47bd4e4500 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -148,7 +148,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass implements Parcelable { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java index 9757756ee7d..1370c6be17d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java @@ -107,7 +107,6 @@ public class Model200Response implements Parcelable { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 991a0d9def4..122dc4d429a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -134,7 +134,6 @@ public class ModelApiResponse implements Parcelable { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java index 92ceace88ea..3684c5be5c7 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -79,7 +79,6 @@ public class ModelReturn implements Parcelable { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java index f9df55d20d6..375ba87e132 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java @@ -144,7 +144,6 @@ public class Name implements Parcelable { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java index 9a19233a42c..c3929e2ce7a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -79,7 +79,6 @@ public class NumberOnly implements Parcelable { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java index 667e83cb197..d6ec2f881d0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java @@ -268,7 +268,6 @@ public class Order implements Parcelable { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java index 190d73706de..6b84b6f36f4 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -135,7 +135,6 @@ public class OuterComposite implements Parcelable { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java index a0cdfdab75e..8ca22387251 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java @@ -284,7 +284,6 @@ public class Pet implements Parcelable { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index fc9f51316ab..abaf904bbba 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -97,7 +97,6 @@ public class ReadOnlyFirst implements Parcelable { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java index e3d068f4c1f..2104c1e6062 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -78,7 +78,6 @@ public class SpecialModelName implements Parcelable { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java index 60fefc6701f..9f44e5098b8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java @@ -106,7 +106,6 @@ public class Tag implements Parcelable { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 4c29c6ab1ef..00568dbc260 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -193,7 +193,6 @@ public class TypeHolderDefault implements Parcelable { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java index d18c289e067..478c59e4aea 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -220,7 +220,6 @@ public class TypeHolderExample implements Parcelable { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java index 69ab1d83945..49df39a3805 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java @@ -274,7 +274,6 @@ public class User implements Parcelable { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java index 13887553ba2..0e7fe46670d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java @@ -937,7 +937,6 @@ public class XmlItem implements Parcelable { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index f79a901b71d..acb0175c213 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 3a728a76023..90e9afca2f0 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -78,7 +78,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 2bd69aca4ab..f6e70331f6e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 077571ff8df..0495881506d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -422,7 +422,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e38eb418615..208dfdbc15f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index ba5b2b9b2cf..b008b847a7e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -78,7 +78,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 4a236c28685..c2ce3b2fbe2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index fa11b0dc474..dcecf6e69dd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java index 6ba2cfafee7..67e9a14d06e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java @@ -107,7 +107,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index fbc5067ee70..7e3ba8195c7 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -85,7 +85,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 72f6fee00ff..279edaea8a7 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -85,7 +85,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java index 4c9e81e8468..b1bfac1da86 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -157,7 +157,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCat.java index 6fa51b1bde4..ee503f76942 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCat.java @@ -131,7 +131,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 99b2714b1b4..a6bdb2bbe3f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -125,7 +125,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java index a18fd8ffdb0..42909659d9c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java @@ -214,7 +214,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java index a3a7ba7eba7..19705043a2f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java @@ -81,7 +81,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/CatAllOf.java index eede69dd633..6be8b4534b1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -74,7 +74,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java index e19b0174656..bc1672714e2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java @@ -101,7 +101,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java index 29fd53f9c88..f43b881b90c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java @@ -75,7 +75,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java index 4a40b04cd47..1702dbadd88 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java @@ -74,7 +74,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java index 02bd48cfa5e..5c80057e78e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java @@ -80,7 +80,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java index c76faa74e38..9e311a1f6af 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -74,7 +74,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java index 0ff5e9216ff..9a9c2f1a59a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -206,7 +206,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java index 49527493f6a..7f325519f9b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java @@ -378,7 +378,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 40a72877e62..a6c4008d1e9 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -112,7 +112,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java index b5e841ec1d9..7809f39132a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java @@ -449,7 +449,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 6b4d1f20626..7f915754ffa 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -84,7 +84,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java index 94379fa3137..f8fedfcde0c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java @@ -240,7 +240,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index ced17913313..0c225d1f6cd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -144,7 +144,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java index e5e0c759fc9..f11d9e5d570 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java @@ -103,7 +103,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java index ef176e1bd10..595d829ad8d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -130,7 +130,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java index ea05ccfecde..dc27972cb67 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -75,7 +75,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java index b424973a4f8..48241077590 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java @@ -140,7 +140,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java index 9b1accdea88..172856aaf7a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -75,7 +75,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java index 02cc2736b7f..34b170e3ecd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java @@ -264,7 +264,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java index 9b933ccfa26..32829a45215 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -131,7 +131,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java index 079cf4e54fc..cdc15037c15 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java @@ -280,7 +280,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 061e70f8951..23ca124c518 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -93,7 +93,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java index b597f67abe6..ffd53c78dee 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -74,7 +74,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java index f6d6fbaf2c6..f34a659e794 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java @@ -102,7 +102,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 911e309fd86..5586c8e6a82 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -189,7 +189,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2b2985f15d4..0d6f48c11ea 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -216,7 +216,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java index ea8fb75113a..86d4751120a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java @@ -270,7 +270,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/XmlItem.java index 3bd9a883c57..a09ec289d51 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/XmlItem.java @@ -933,7 +933,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 1b0f85ea821..ac7f3646e18 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -85,7 +85,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 530a2d2af50..6eac5af20da 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -86,7 +86,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 195ced31dfb..dbde88f9b06 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -85,7 +85,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 8f4e4f11345..48240c82341 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -455,7 +455,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index fb349f37b8e..0d4f46ef5db 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -85,7 +85,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index de35ebc6cb3..a906a139825 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -86,7 +86,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index e932ac3afd5..5da7386c139 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -85,7 +85,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 0d10d122d51..a66e3a25ccb 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -85,7 +85,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Animal.java index 292a0b35c13..9ae43c3ff0a 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Animal.java @@ -124,7 +124,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index f8258e1ce4d..9505daddb10 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -94,7 +94,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 3ed7941a3a4..097fa5a5864 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -94,7 +94,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java index 49953f10102..4bc57f9b036 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -171,7 +171,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/BigCat.java index 7d38a0ea6d1..50a6dae7fab 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/BigCat.java @@ -128,7 +128,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 51f909f6043..d01785b72cf 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -121,7 +121,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Capitalization.java index 7c5949f23b6..b74b3706816 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Capitalization.java @@ -232,7 +232,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Cat.java index 966caa81bf3..e2f3f992ab3 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Cat.java @@ -93,7 +93,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/CatAllOf.java index eededeed932..818f20e03c4 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -82,7 +82,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Category.java index 8428649b95c..618c51c82d4 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Category.java @@ -112,7 +112,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ClassModel.java index 9bf242ec11e..cf105b8f04e 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ClassModel.java @@ -83,7 +83,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Client.java index 11e8f32ed81..cc732df66f4 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Client.java @@ -82,7 +82,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Dog.java index 6ebb75fc962..28086281fbb 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Dog.java @@ -89,7 +89,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/DogAllOf.java index 89c7c1f1424..7a44a9eef3f 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -82,7 +82,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java index 222fd41f176..0077afda65e 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -192,7 +192,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/EnumTest.java index 5a4259b60f2..6cfb06fdebf 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/EnumTest.java @@ -348,7 +348,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 565c508fe66..0774ba50ddd 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -124,7 +124,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/FormatTest.java index dae27079274..27ee581d55b 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/FormatTest.java @@ -493,7 +493,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 510b7604c1b..b7d84a73afb 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -94,7 +94,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/MapTest.java index 3c152244802..7132318d025 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/MapTest.java @@ -243,7 +243,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index c5815ca8684..db774439c9e 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -159,7 +159,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Model200Response.java index 3ef91801b01..0994dd28b4e 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Model200Response.java @@ -113,7 +113,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 5f33abe5d9d..2c4f7ea6df5 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -142,7 +142,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java index 29c8e20585b..f285424acf2 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -83,7 +83,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Name.java index 3ad646c8efa..45e058db3f1 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Name.java @@ -155,7 +155,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java index 3f9dbefe504..d55295ede71 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -84,7 +84,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Order.java index b925f5d026b..1e001ee7ff9 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Order.java @@ -271,7 +271,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java index a0fc150080f..b10d7e2a6cd 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -144,7 +144,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Pet.java index cd5bb7b256e..9f968025ad6 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Pet.java @@ -290,7 +290,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index be933220047..f4c3651fe16 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -103,7 +103,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java index 49b028ade70..2160dfb82db 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -82,7 +82,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Tag.java index d0ef844f6b8..34fda46f4b8 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/Tag.java @@ -112,7 +112,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 36c55bfb4a7..40f4bb26f62 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -211,7 +211,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2c7ea241f6e..cbe4b8f43f5 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -241,7 +241,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/User.java index 0254603b367..04e90e0e9fb 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/User.java @@ -292,7 +292,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/XmlItem.java index 6a2775a81fc..01db682136b 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/model/XmlItem.java @@ -1002,7 +1002,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 902d054a711..ce745ee4ef6 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -80,7 +80,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index f8a6fb29812..8cce4941b32 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -81,7 +81,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 7b51fb445a9..90182c8b125 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -80,7 +80,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 55cbf3ef484..1b74276b62a 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -430,7 +430,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index ee96ce6688c..0bc28f8419e 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -80,7 +80,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index efb2ac443c8..f74b57204ca 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -81,7 +81,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 94bc0be0ef0..31375b34814 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -80,7 +80,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 88e278c1b85..da3b0758ca6 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -80,7 +80,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Animal.java index d5f085d99ac..ca996c926a5 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Animal.java @@ -111,7 +111,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 1130cb952bb..e8722a17ecb 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -89,7 +89,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 852c6df189f..db2ca52d05b 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -89,7 +89,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayTest.java index ff6848cbc9b..7d5f3424b6f 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -162,7 +162,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCat.java index caa71250705..41f04384b0f 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCat.java @@ -134,7 +134,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 3f11bd68748..37247aea21b 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -128,7 +128,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Capitalization.java index 751bf2ccfab..e5b2f360b70 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Capitalization.java @@ -217,7 +217,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Cat.java index 38840251077..b71f9425340 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Cat.java @@ -84,7 +84,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/CatAllOf.java index f0d3aa5ff74..fe3831b05ec 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -77,7 +77,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java index 04c7fcb8621..3bdfcdd73a1 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java @@ -105,7 +105,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ClassModel.java index 421a07df065..b10c2edf12d 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ClassModel.java @@ -78,7 +78,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Client.java index c44160b94ac..ef207b1dba6 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Client.java @@ -77,7 +77,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Dog.java index 754915e1089..0afb21e75a2 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Dog.java @@ -83,7 +83,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/DogAllOf.java index 45fb72a7213..dbf0844cb40 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -77,7 +77,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java index 2daaad5b694..b3d2efba73a 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -209,7 +209,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumTest.java index 351ee89465b..cacc86fc816 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumTest.java @@ -383,7 +383,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index b2b6ed0fb47..3007cfaf0f5 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -117,7 +117,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FormatTest.java index e00a4500211..8c437f1fe1c 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FormatTest.java @@ -462,7 +462,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 82faa4a42db..7ebe8807f1e 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -87,7 +87,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java index 8ef66b594c5..9b23ee3291c 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java @@ -244,7 +244,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index e6897bd51f3..e7a34876fc4 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -150,7 +150,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Model200Response.java index 6f6bf4b71dd..8fabafe07eb 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Model200Response.java @@ -106,7 +106,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 8d8941ce49b..9ac46956160 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -133,7 +133,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelReturn.java index 4452bfefab9..8c848546c53 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -78,7 +78,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Name.java index aa03aa041ce..217eb056290 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Name.java @@ -144,7 +144,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/NumberOnly.java index 39d570eb9f7..2dc1f6f02a6 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -79,7 +79,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Order.java index 69204c4ce74..477b9c8a3df 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Order.java @@ -268,7 +268,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/OuterComposite.java index 499252bb3e6..2013747843e 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -135,7 +135,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java index f3530212571..bb57e68be58 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java @@ -287,7 +287,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index b7ebd8c5028..14b4529553f 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -96,7 +96,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/SpecialModelName.java index ae9fe7a7392..264c1ec4856 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -77,7 +77,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Tag.java index d409103256c..d3fc7c16d14 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Tag.java @@ -105,7 +105,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 35981b8f108..77230529e89 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -198,7 +198,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderExample.java index d527ccc144b..b5c3e2c014e 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -226,7 +226,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/User.java index e0e82adeaa6..f46e3487727 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/User.java @@ -273,7 +273,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/XmlItem.java index a0286e54452..b0bf2ff8ee3 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/XmlItem.java @@ -941,7 +941,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 497124467a2..366143d1fc0 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index d638cd95bf4..7a5e9587e65 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 5ce0e7937f5..8f017af3507 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index dca8ec41b68..e442eea3121 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -447,7 +447,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e7f70c5fb0d..8e85dd20fe7 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index e96cab6e53e..50db851ff00 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index fb48dd0c264..b6fcfc25ba8 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 932cfecb044..20bbfd1117d 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java index 6f15310fd8c..c33e153c751 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java @@ -120,7 +120,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 27ce18d552d..459f4602965 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b6d3b256a24..8becb8dd2b0 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayTest.java index 38399bfe582..8747730a9dd 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -166,7 +166,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCat.java index c000e826f31..ccfdc5a5ec0 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCat.java @@ -125,7 +125,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 81a5b56ed64..481e22e0df1 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -118,7 +118,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Capitalization.java index 27d2258b3fa..2065be194db 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Capitalization.java @@ -229,7 +229,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Cat.java index d04c3ecd1a5..10d8036c414 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Cat.java @@ -90,7 +90,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/CatAllOf.java index 153873956c9..38910bf5c69 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -79,7 +79,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java index ddd999f84c6..3737dbb3c3e 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java @@ -108,7 +108,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ClassModel.java index 3e2216e6ae4..227bdaae556 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ClassModel.java @@ -80,7 +80,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Client.java index 2147430592b..9fea8958838 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Client.java @@ -79,7 +79,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Dog.java index 559b170c4f7..d54ac1b7a2f 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Dog.java @@ -86,7 +86,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/DogAllOf.java index 9f3d303c1ab..449c4e6f051 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -79,7 +79,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java index c38d53553cb..4944b28bdfe 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -189,7 +189,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumTest.java index bc6ce93c566..7589d69aa6d 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumTest.java @@ -343,7 +343,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index f427cf921f6..074b99080e7 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -119,7 +119,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FormatTest.java index 23f3e20db17..5f8a894641d 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FormatTest.java @@ -480,7 +480,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index bd976488179..4f7e8a75ca2 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -91,7 +91,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java index 1271533e5be..b5921775cfd 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java @@ -239,7 +239,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index fdb9393a657..dbb1682a919 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -153,7 +153,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Model200Response.java index 6bba2623f4b..bc3bee0e09a 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Model200Response.java @@ -110,7 +110,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 97921db1707..47f88db907b 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -139,7 +139,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelReturn.java index f28c2ac46ea..1b2a532f60c 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -80,7 +80,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Name.java index 7ba7d886ce2..1da9e1433c1 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Name.java @@ -151,7 +151,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NumberOnly.java index 54be0a4cbf0..d1f21fa5942 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -80,7 +80,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Order.java index a8396385767..ef256856406 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Order.java @@ -267,7 +267,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/OuterComposite.java index bfea026235e..32db00927cb 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -140,7 +140,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java index 2ac06b78334..fca1a5141de 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java @@ -283,7 +283,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 455300cd7f8..f866409c5bd 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -100,7 +100,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/SpecialModelName.java index ac1bfcbd846..2a7c39ec8e8 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -79,7 +79,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Tag.java index a95f8f4a4d8..9630d272242 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Tag.java @@ -109,7 +109,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 53bf7905e15..5e13ac4ab73 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -202,7 +202,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 68fa374847d..7b89d392f5e 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -231,7 +231,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/User.java index 49ed08dff9a..ba6825df44e 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/User.java @@ -289,7 +289,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/XmlItem.java index 1067826b0d5..1a621d2e710 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/XmlItem.java @@ -994,7 +994,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index dfeff427205..8387ffb9d7f 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -89,7 +89,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index c598fe3adc7..9bfa9e1dd34 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -90,7 +90,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index fac897ed6ca..8c4a52fb6d7 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -89,7 +89,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 87aeed9fa26..96c4830090c 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -490,7 +490,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index 91ac1a36e87..bd5df4cfef7 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -89,7 +89,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index f16c414c1ff..8282571e605 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -90,7 +90,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 82422bfbc93..e8eba34a8e2 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -89,7 +89,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 45f6e2ebf69..0eb4bcabea4 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -89,7 +89,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java index 7f0b89733ac..899db978f9e 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java @@ -129,7 +129,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 34e15755d1a..563eefe73f4 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -99,7 +99,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 90b91865675..7d541000c63 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -99,7 +99,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java index c608ad4b827..f51ac1266fb 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -183,7 +183,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCat.java index 742777ba7d6..43aee30817f 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCat.java @@ -132,7 +132,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCatAllOf.java index d193e571bfc..1b081179142 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -125,7 +125,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Capitalization.java index 7b8298c2b63..aac1ec0e232 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Capitalization.java @@ -246,7 +246,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Cat.java index f67b94b1767..ac98f4380f9 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Cat.java @@ -97,7 +97,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/CatAllOf.java index 40fc9e07e40..7ff5f466e2d 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -86,7 +86,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java index aa2163c19fb..384110e1f44 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java @@ -117,7 +117,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ClassModel.java index 7b316f95a82..f538dedcfae 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ClassModel.java @@ -87,7 +87,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Client.java index ab49e49f6d1..92f2df27410 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Client.java @@ -86,7 +86,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Dog.java index 7f16af13ced..e64a250d553 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Dog.java @@ -93,7 +93,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/DogAllOf.java index 083d46651f7..142036009f6 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -86,7 +86,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java index 5c59edc23f7..bf6293c0801 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -200,7 +200,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumTest.java index 3eaf1a6ddfc..922ca402ed6 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumTest.java @@ -358,7 +358,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index ae70d339f3d..85810f4a827 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -130,7 +130,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FormatTest.java index 25198c3854c..a13aaeac244 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FormatTest.java @@ -513,7 +513,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 117a44fe53a..e728ade4ee7 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -100,7 +100,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java index 70841a35988..87bd0e3132c 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java @@ -260,7 +260,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 68c325a6537..21ccdd991c5 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -166,7 +166,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Model200Response.java index f565e80fcce..94a6e89ab88 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Model200Response.java @@ -119,7 +119,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 43207f5eec3..f9b2752ca3d 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -150,7 +150,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelReturn.java index 236a46c32f1..4c6988e9648 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -87,7 +87,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Name.java index 5458f4f9f93..327dedcaf2e 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Name.java @@ -164,7 +164,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NumberOnly.java index 2345a3dfb7d..e80fbe7f6a7 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -87,7 +87,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Order.java index 37cbdb1ccc2..cab2dcadf4a 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Order.java @@ -284,7 +284,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/OuterComposite.java index b5834711ded..ceb89c57e6c 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -151,7 +151,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java index 66b6b012cc9..f6498477356 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java @@ -310,7 +310,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index ae416979044..4b104de8eba 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -109,7 +109,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/SpecialModelName.java index 59c55cbfd70..00ace36bcfe 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -86,7 +86,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Tag.java index b6234138039..c978964642c 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Tag.java @@ -118,7 +118,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 8799eb056c4..0ef707b6746 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -219,7 +219,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java index ebed8649f0f..80fb12122b3 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -250,7 +250,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/User.java index 95215b55c57..d69d4cdcc23 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/User.java @@ -310,7 +310,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java index 5d3a673bb8f..684ded6d3b1 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java @@ -1090,7 +1090,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 497124467a2..366143d1fc0 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index d638cd95bf4..7a5e9587e65 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 5ce0e7937f5..8f017af3507 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index dca8ec41b68..e442eea3121 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -447,7 +447,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e7f70c5fb0d..8e85dd20fe7 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index e96cab6e53e..50db851ff00 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index fb48dd0c264..b6fcfc25ba8 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 932cfecb044..20bbfd1117d 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java index 6f15310fd8c..c33e153c751 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java @@ -120,7 +120,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 27ce18d552d..459f4602965 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index b6d3b256a24..8becb8dd2b0 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java index 38399bfe582..8747730a9dd 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -166,7 +166,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCat.java index c000e826f31..ccfdc5a5ec0 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCat.java @@ -125,7 +125,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 81a5b56ed64..481e22e0df1 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -118,7 +118,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java index 27d2258b3fa..2065be194db 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java @@ -229,7 +229,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java index d04c3ecd1a5..10d8036c414 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java @@ -90,7 +90,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/CatAllOf.java index 153873956c9..38910bf5c69 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -79,7 +79,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java index ddd999f84c6..3737dbb3c3e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java @@ -108,7 +108,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java index 3e2216e6ae4..227bdaae556 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java @@ -80,7 +80,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java index 2147430592b..9fea8958838 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java @@ -79,7 +79,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java index 559b170c4f7..d54ac1b7a2f 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java @@ -86,7 +86,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DogAllOf.java index 9f3d303c1ab..449c4e6f051 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -79,7 +79,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java index c38d53553cb..4944b28bdfe 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -189,7 +189,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java index bc6ce93c566..7589d69aa6d 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java @@ -343,7 +343,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index f427cf921f6..074b99080e7 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -119,7 +119,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java index 23f3e20db17..5f8a894641d 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java @@ -480,7 +480,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index bd976488179..4f7e8a75ca2 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -91,7 +91,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java index 1271533e5be..b5921775cfd 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java @@ -239,7 +239,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index fdb9393a657..dbb1682a919 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -153,7 +153,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java index 6bba2623f4b..bc3bee0e09a 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java @@ -110,7 +110,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 97921db1707..47f88db907b 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -139,7 +139,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java index f28c2ac46ea..1b2a532f60c 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -80,7 +80,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java index 7ba7d886ce2..1da9e1433c1 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java @@ -151,7 +151,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java index 54be0a4cbf0..d1f21fa5942 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -80,7 +80,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java index a8396385767..ef256856406 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java @@ -267,7 +267,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java index bfea026235e..32db00927cb 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -140,7 +140,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java index 2ac06b78334..fca1a5141de 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java @@ -283,7 +283,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 455300cd7f8..f866409c5bd 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -100,7 +100,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java index ac1bfcbd846..2a7c39ec8e8 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -79,7 +79,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java index a95f8f4a4d8..9630d272242 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java @@ -109,7 +109,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 53bf7905e15..5e13ac4ab73 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -202,7 +202,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 68fa374847d..7b89d392f5e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -231,7 +231,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java index 49ed08dff9a..ba6825df44e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java @@ -289,7 +289,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/XmlItem.java index 1067826b0d5..1a621d2e710 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/XmlItem.java @@ -994,7 +994,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 144b47e2d7c..108c5441731 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -84,7 +84,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 6478ffb05fb..afd118c1604 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -85,7 +85,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index edd2bc2949a..c029a331395 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -84,7 +84,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 9a2ae4aa491..016851e60d5 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -454,7 +454,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e756ab49bd8..1749bdbab0b 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -84,7 +84,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index bb5dcc2d281..9641760739b 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -85,7 +85,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index e02323889d7..0919d9853c0 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -84,7 +84,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index caac18bf2c8..4a37d8fd1c5 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -84,7 +84,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Animal.java index 580f1e1e405..1843bdc8010 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Animal.java @@ -123,7 +123,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 61735419075..a198249bc5d 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -93,7 +93,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index ba62e31e97a..b9985f1bb89 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -93,7 +93,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayTest.java index 543ef525a46..40ec5a9f1ca 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -170,7 +170,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCat.java index 9c57db183ba..f06ac3b65c9 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCat.java @@ -127,7 +127,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 4a88944ad3e..a048db4855d 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -120,7 +120,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Capitalization.java index 4b3f68e992d..b37ca9a3061 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Capitalization.java @@ -231,7 +231,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Cat.java index 286e0959df4..daad65c9248 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Cat.java @@ -92,7 +92,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/CatAllOf.java index ff278cc11cf..c4bb17072e4 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -81,7 +81,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Category.java index ab930b472d1..9cec2c4afc7 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Category.java @@ -111,7 +111,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ClassModel.java index 7cf79bc5df0..cca89d753ff 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ClassModel.java @@ -82,7 +82,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Client.java index f494760ce31..ebeb9efdaef 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Client.java @@ -81,7 +81,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Dog.java index 87a374873f3..e0b5ddf0b5a 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Dog.java @@ -88,7 +88,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/DogAllOf.java index 422d92d8f23..76a440b0b7d 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -81,7 +81,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumArrays.java index 02fcd6f3b73..e50eb2f3f10 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -191,7 +191,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumTest.java index 63753f124dc..ede00732dc9 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumTest.java @@ -347,7 +347,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index a9b6de87bcc..18e35f8d431 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -123,7 +123,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FormatTest.java index 089d1867402..22b93699569 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FormatTest.java @@ -492,7 +492,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index fb3a53ed5b8..2b95c45be10 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -93,7 +93,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MapTest.java index cc5c1a797a5..561ac6a6e48 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MapTest.java @@ -242,7 +242,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index d6cd5acc7d4..62a690889d8 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -158,7 +158,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Model200Response.java index ecaec06a7e1..31c0cf95c44 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Model200Response.java @@ -112,7 +112,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 90d9704701f..dfbe3b0d9f1 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -141,7 +141,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelReturn.java index db09aa0380d..3156ea25136 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -82,7 +82,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Name.java index 12115c28cbc..80219556372 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Name.java @@ -154,7 +154,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/NumberOnly.java index 26556a3ebe2..2fa9c4ee331 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -83,7 +83,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Order.java index a9d4770c437..a406d64c07b 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Order.java @@ -270,7 +270,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/OuterComposite.java index 1b2193710e1..66abc21150d 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -143,7 +143,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Pet.java index 487d1cbc1e5..a10d99865da 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Pet.java @@ -289,7 +289,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 0dcf55396a4..6c711fd90d2 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -102,7 +102,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/SpecialModelName.java index 4760bc0cc9c..2a39bcd5a7f 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -81,7 +81,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Tag.java index afe0284cec5..f7844afbd2f 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Tag.java @@ -111,7 +111,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 18bf2f175a9..3138e14f0c7 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -210,7 +210,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/TypeHolderExample.java index de94f0b1350..639a8335beb 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -240,7 +240,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/User.java index f13daf5990f..75dbe101bdf 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/User.java @@ -291,7 +291,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/XmlItem.java index 156b020f7a9..e8c3b0997cd 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/XmlItem.java @@ -1001,7 +1001,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index f79a901b71d..acb0175c213 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 3a728a76023..90e9afca2f0 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -78,7 +78,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 2bd69aca4ab..f6e70331f6e 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 077571ff8df..0495881506d 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -422,7 +422,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e38eb418615..208dfdbc15f 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index ba5b2b9b2cf..b008b847a7e 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -78,7 +78,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 4a236c28685..c2ce3b2fbe2 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index fa11b0dc474..dcecf6e69dd 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Animal.java index 6ba2cfafee7..67e9a14d06e 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Animal.java @@ -107,7 +107,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index fbc5067ee70..7e3ba8195c7 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -85,7 +85,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 72f6fee00ff..279edaea8a7 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -85,7 +85,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayTest.java index 4c9e81e8468..b1bfac1da86 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -157,7 +157,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCat.java index 6fa51b1bde4..ee503f76942 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCat.java @@ -131,7 +131,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 99b2714b1b4..a6bdb2bbe3f 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -125,7 +125,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Capitalization.java index a18fd8ffdb0..42909659d9c 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Capitalization.java @@ -214,7 +214,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Cat.java index a3a7ba7eba7..19705043a2f 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Cat.java @@ -81,7 +81,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/CatAllOf.java index eede69dd633..6be8b4534b1 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -74,7 +74,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java index e19b0174656..bc1672714e2 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java @@ -101,7 +101,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ClassModel.java index 29fd53f9c88..f43b881b90c 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ClassModel.java @@ -75,7 +75,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Client.java index 4a40b04cd47..1702dbadd88 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Client.java @@ -74,7 +74,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Dog.java index 02bd48cfa5e..5c80057e78e 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Dog.java @@ -80,7 +80,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/DogAllOf.java index c76faa74e38..9e311a1f6af 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -74,7 +74,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java index 0ff5e9216ff..9a9c2f1a59a 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -206,7 +206,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumTest.java index 49527493f6a..7f325519f9b 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumTest.java @@ -378,7 +378,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 40a72877e62..a6c4008d1e9 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -112,7 +112,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FormatTest.java index b5e841ec1d9..7809f39132a 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FormatTest.java @@ -449,7 +449,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 6b4d1f20626..7f915754ffa 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -84,7 +84,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java index 94379fa3137..f8fedfcde0c 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java @@ -240,7 +240,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index ced17913313..0c225d1f6cd 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -144,7 +144,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Model200Response.java index e5e0c759fc9..f11d9e5d570 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Model200Response.java @@ -103,7 +103,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelApiResponse.java index ef176e1bd10..595d829ad8d 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -130,7 +130,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelReturn.java index ea05ccfecde..dc27972cb67 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -75,7 +75,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Name.java index b424973a4f8..48241077590 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Name.java @@ -140,7 +140,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/NumberOnly.java index 9b1accdea88..172856aaf7a 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -75,7 +75,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Order.java index 02cc2736b7f..34b170e3ecd 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Order.java @@ -264,7 +264,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/OuterComposite.java index 9b933ccfa26..32829a45215 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -131,7 +131,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java index 079cf4e54fc..cdc15037c15 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java @@ -280,7 +280,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 061e70f8951..23ca124c518 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -93,7 +93,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/SpecialModelName.java index b597f67abe6..ffd53c78dee 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -74,7 +74,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Tag.java index f6d6fbaf2c6..f34a659e794 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Tag.java @@ -102,7 +102,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 911e309fd86..5586c8e6a82 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -189,7 +189,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2b2985f15d4..0d6f48c11ea 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -216,7 +216,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/User.java index ea8fb75113a..86d4751120a 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/User.java @@ -270,7 +270,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/XmlItem.java index 3bd9a883c57..a09ec289d51 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/XmlItem.java @@ -933,7 +933,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index f79a901b71d..acb0175c213 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 3a728a76023..90e9afca2f0 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -78,7 +78,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 2bd69aca4ab..f6e70331f6e 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 077571ff8df..0495881506d 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -422,7 +422,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e38eb418615..208dfdbc15f 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index ba5b2b9b2cf..b008b847a7e 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -78,7 +78,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 4a236c28685..c2ce3b2fbe2 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index fa11b0dc474..dcecf6e69dd 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Animal.java index 6ba2cfafee7..67e9a14d06e 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Animal.java @@ -107,7 +107,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index fbc5067ee70..7e3ba8195c7 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -85,7 +85,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 72f6fee00ff..279edaea8a7 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -85,7 +85,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayTest.java index 4c9e81e8468..b1bfac1da86 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -157,7 +157,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCat.java index 6fa51b1bde4..ee503f76942 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCat.java @@ -131,7 +131,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 99b2714b1b4..a6bdb2bbe3f 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -125,7 +125,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Capitalization.java index a18fd8ffdb0..42909659d9c 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Capitalization.java @@ -214,7 +214,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Cat.java index a3a7ba7eba7..19705043a2f 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Cat.java @@ -81,7 +81,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/CatAllOf.java index eede69dd633..6be8b4534b1 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -74,7 +74,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java index e19b0174656..bc1672714e2 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java @@ -101,7 +101,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ClassModel.java index 29fd53f9c88..f43b881b90c 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ClassModel.java @@ -75,7 +75,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Client.java index 4a40b04cd47..1702dbadd88 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Client.java @@ -74,7 +74,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Dog.java index 02bd48cfa5e..5c80057e78e 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Dog.java @@ -80,7 +80,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/DogAllOf.java index c76faa74e38..9e311a1f6af 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -74,7 +74,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java index 0ff5e9216ff..9a9c2f1a59a 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -206,7 +206,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumTest.java index 49527493f6a..7f325519f9b 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumTest.java @@ -378,7 +378,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 40a72877e62..a6c4008d1e9 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -112,7 +112,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FormatTest.java index b5e841ec1d9..7809f39132a 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FormatTest.java @@ -449,7 +449,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 6b4d1f20626..7f915754ffa 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -84,7 +84,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java index 94379fa3137..f8fedfcde0c 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java @@ -240,7 +240,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index ced17913313..0c225d1f6cd 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -144,7 +144,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Model200Response.java index e5e0c759fc9..f11d9e5d570 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Model200Response.java @@ -103,7 +103,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelApiResponse.java index ef176e1bd10..595d829ad8d 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -130,7 +130,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelReturn.java index ea05ccfecde..dc27972cb67 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -75,7 +75,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Name.java index b424973a4f8..48241077590 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Name.java @@ -140,7 +140,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/NumberOnly.java index 9b1accdea88..172856aaf7a 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -75,7 +75,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Order.java index 02cc2736b7f..34b170e3ecd 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Order.java @@ -264,7 +264,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/OuterComposite.java index 9b933ccfa26..32829a45215 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -131,7 +131,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java index 079cf4e54fc..cdc15037c15 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java @@ -280,7 +280,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 061e70f8951..23ca124c518 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -93,7 +93,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/SpecialModelName.java index b597f67abe6..ffd53c78dee 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -74,7 +74,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Tag.java index f6d6fbaf2c6..f34a659e794 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Tag.java @@ -102,7 +102,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 911e309fd86..5586c8e6a82 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -189,7 +189,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2b2985f15d4..0d6f48c11ea 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -216,7 +216,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/User.java index ea8fb75113a..86d4751120a 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/User.java @@ -270,7 +270,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/XmlItem.java index 3bd9a883c57..a09ec289d51 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/XmlItem.java @@ -933,7 +933,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index f79a901b71d..acb0175c213 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 3a728a76023..90e9afca2f0 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -78,7 +78,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 2bd69aca4ab..f6e70331f6e 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 077571ff8df..0495881506d 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -422,7 +422,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e38eb418615..208dfdbc15f 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index ba5b2b9b2cf..b008b847a7e 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -78,7 +78,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 4a236c28685..c2ce3b2fbe2 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index fa11b0dc474..dcecf6e69dd 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -77,7 +77,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Animal.java index 6ba2cfafee7..67e9a14d06e 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Animal.java @@ -107,7 +107,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index fbc5067ee70..7e3ba8195c7 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -85,7 +85,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 72f6fee00ff..279edaea8a7 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -85,7 +85,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayTest.java index 4c9e81e8468..b1bfac1da86 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -157,7 +157,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/BigCat.java index 6fa51b1bde4..ee503f76942 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/BigCat.java @@ -131,7 +131,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 99b2714b1b4..a6bdb2bbe3f 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -125,7 +125,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Capitalization.java index a18fd8ffdb0..42909659d9c 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Capitalization.java @@ -214,7 +214,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Cat.java index a3a7ba7eba7..19705043a2f 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Cat.java @@ -81,7 +81,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/CatAllOf.java index eede69dd633..6be8b4534b1 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -74,7 +74,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Category.java index e19b0174656..bc1672714e2 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Category.java @@ -101,7 +101,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ClassModel.java index 29fd53f9c88..f43b881b90c 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ClassModel.java @@ -75,7 +75,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Client.java index 4a40b04cd47..1702dbadd88 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Client.java @@ -74,7 +74,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Dog.java index 02bd48cfa5e..5c80057e78e 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Dog.java @@ -80,7 +80,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/DogAllOf.java index c76faa74e38..9e311a1f6af 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -74,7 +74,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumArrays.java index 0ff5e9216ff..9a9c2f1a59a 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -206,7 +206,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumTest.java index 49527493f6a..7f325519f9b 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/EnumTest.java @@ -378,7 +378,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 40a72877e62..a6c4008d1e9 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -112,7 +112,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FormatTest.java index b5e841ec1d9..7809f39132a 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/FormatTest.java @@ -449,7 +449,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 6b4d1f20626..7f915754ffa 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -84,7 +84,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MapTest.java index 94379fa3137..f8fedfcde0c 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MapTest.java @@ -240,7 +240,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index ced17913313..0c225d1f6cd 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -144,7 +144,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Model200Response.java index e5e0c759fc9..f11d9e5d570 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Model200Response.java @@ -103,7 +103,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ModelApiResponse.java index ef176e1bd10..595d829ad8d 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -130,7 +130,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ModelReturn.java index ea05ccfecde..dc27972cb67 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -75,7 +75,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Name.java index b424973a4f8..48241077590 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Name.java @@ -140,7 +140,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/NumberOnly.java index 9b1accdea88..172856aaf7a 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -75,7 +75,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Order.java index 02cc2736b7f..34b170e3ecd 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Order.java @@ -264,7 +264,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/OuterComposite.java index 9b933ccfa26..32829a45215 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -131,7 +131,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Pet.java index 079cf4e54fc..cdc15037c15 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Pet.java @@ -280,7 +280,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 061e70f8951..23ca124c518 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -93,7 +93,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/SpecialModelName.java index b597f67abe6..ffd53c78dee 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -74,7 +74,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Tag.java index f6d6fbaf2c6..f34a659e794 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/Tag.java @@ -102,7 +102,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 911e309fd86..5586c8e6a82 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -189,7 +189,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2b2985f15d4..0d6f48c11ea 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -216,7 +216,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/User.java index ea8fb75113a..86d4751120a 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/User.java @@ -270,7 +270,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/XmlItem.java index 3bd9a883c57..a09ec289d51 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/model/XmlItem.java @@ -933,7 +933,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 497124467a2..366143d1fc0 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index d638cd95bf4..7a5e9587e65 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 5ce0e7937f5..8f017af3507 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index e133c0e8218..94d3394a381 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -447,7 +447,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e7f70c5fb0d..8e85dd20fe7 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index e96cab6e53e..50db851ff00 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index fb48dd0c264..b6fcfc25ba8 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 932cfecb044..20bbfd1117d 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Animal.java index 6f15310fd8c..c33e153c751 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Animal.java @@ -120,7 +120,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 366494a73a5..6f7b19e3be4 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 60a0c6bb707..18c4a58ef99 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java index cf38d789167..41d2808a066 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -166,7 +166,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/BigCat.java index c000e826f31..ccfdc5a5ec0 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/BigCat.java @@ -125,7 +125,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 81a5b56ed64..481e22e0df1 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -118,7 +118,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Capitalization.java index 27d2258b3fa..2065be194db 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Capitalization.java @@ -229,7 +229,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Cat.java index d04c3ecd1a5..10d8036c414 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Cat.java @@ -90,7 +90,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/CatAllOf.java index 153873956c9..38910bf5c69 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -79,7 +79,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Category.java index ddd999f84c6..3737dbb3c3e 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Category.java @@ -108,7 +108,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ClassModel.java index 3e2216e6ae4..227bdaae556 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ClassModel.java @@ -80,7 +80,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Client.java index 2147430592b..9fea8958838 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Client.java @@ -79,7 +79,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Dog.java index 559b170c4f7..d54ac1b7a2f 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Dog.java @@ -86,7 +86,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/DogAllOf.java index 9f3d303c1ab..449c4e6f051 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -79,7 +79,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java index 6ed55a192bc..3836607265e 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -189,7 +189,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/EnumTest.java index bc6ce93c566..7589d69aa6d 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/EnumTest.java @@ -343,7 +343,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index bac6aa62f07..67596f2c9bd 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -119,7 +119,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/FormatTest.java index 719ffd4c8d0..a5de78e55dc 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/FormatTest.java @@ -480,7 +480,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index bd976488179..4f7e8a75ca2 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -91,7 +91,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java index ccb739e3bb8..dc0f170c75a 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/MapTest.java @@ -239,7 +239,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 9ce84ceeb3c..ec219837214 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -153,7 +153,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Model200Response.java index 6bba2623f4b..bc3bee0e09a 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Model200Response.java @@ -110,7 +110,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 97921db1707..47f88db907b 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -139,7 +139,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ModelReturn.java index f28c2ac46ea..1b2a532f60c 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -80,7 +80,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Name.java index 7ba7d886ce2..1da9e1433c1 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Name.java @@ -151,7 +151,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/NumberOnly.java index 54be0a4cbf0..d1f21fa5942 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -80,7 +80,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Order.java index a8396385767..ef256856406 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Order.java @@ -267,7 +267,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/OuterComposite.java index bfea026235e..32db00927cb 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -140,7 +140,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Pet.java index 25d1f3c49f0..457cab4ac41 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Pet.java @@ -283,7 +283,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 455300cd7f8..f866409c5bd 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -100,7 +100,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/SpecialModelName.java index ac1bfcbd846..2a7c39ec8e8 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -79,7 +79,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Tag.java index a95f8f4a4d8..9630d272242 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/Tag.java @@ -109,7 +109,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 027702c3767..5232c14dbc3 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -202,7 +202,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2c8941f56e7..58d82e2d6fc 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -231,7 +231,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/User.java index 49ed08dff9a..ba6825df44e 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/User.java @@ -289,7 +289,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java index 2ffd4927861..a68ed7a61d1 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/model/XmlItem.java @@ -994,7 +994,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 497124467a2..366143d1fc0 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index d638cd95bf4..7a5e9587e65 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 5ce0e7937f5..8f017af3507 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index e133c0e8218..94d3394a381 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -447,7 +447,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e7f70c5fb0d..8e85dd20fe7 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index e96cab6e53e..50db851ff00 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index fb48dd0c264..b6fcfc25ba8 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 932cfecb044..20bbfd1117d 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java index 6f15310fd8c..c33e153c751 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java @@ -120,7 +120,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 366494a73a5..6f7b19e3be4 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 60a0c6bb707..18c4a58ef99 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayTest.java index cf38d789167..41d2808a066 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -166,7 +166,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCat.java index c000e826f31..ccfdc5a5ec0 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCat.java @@ -125,7 +125,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 81a5b56ed64..481e22e0df1 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -118,7 +118,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Capitalization.java index 27d2258b3fa..2065be194db 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Capitalization.java @@ -229,7 +229,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Cat.java index d04c3ecd1a5..10d8036c414 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Cat.java @@ -90,7 +90,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/CatAllOf.java index 153873956c9..38910bf5c69 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -79,7 +79,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java index ddd999f84c6..3737dbb3c3e 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java @@ -108,7 +108,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ClassModel.java index 3e2216e6ae4..227bdaae556 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ClassModel.java @@ -80,7 +80,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Client.java index 2147430592b..9fea8958838 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Client.java @@ -79,7 +79,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Dog.java index 559b170c4f7..d54ac1b7a2f 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Dog.java @@ -86,7 +86,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/DogAllOf.java index 9f3d303c1ab..449c4e6f051 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -79,7 +79,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumArrays.java index 6ed55a192bc..3836607265e 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -189,7 +189,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumTest.java index bc6ce93c566..7589d69aa6d 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumTest.java @@ -343,7 +343,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index bac6aa62f07..67596f2c9bd 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -119,7 +119,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FormatTest.java index d806519b175..ef57b215bdd 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FormatTest.java @@ -480,7 +480,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index bd976488179..4f7e8a75ca2 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -91,7 +91,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MapTest.java index ccb739e3bb8..dc0f170c75a 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MapTest.java @@ -239,7 +239,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index a8261ac47a5..c674dc908b7 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -153,7 +153,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Model200Response.java index 6bba2623f4b..bc3bee0e09a 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Model200Response.java @@ -110,7 +110,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 97921db1707..47f88db907b 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -139,7 +139,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelReturn.java index f28c2ac46ea..1b2a532f60c 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -80,7 +80,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Name.java index 7ba7d886ce2..1da9e1433c1 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Name.java @@ -151,7 +151,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NumberOnly.java index 54be0a4cbf0..d1f21fa5942 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -80,7 +80,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Order.java index d975c6afa6b..20ad6ca5d34 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Order.java @@ -267,7 +267,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/OuterComposite.java index bfea026235e..32db00927cb 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -140,7 +140,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Pet.java index 25d1f3c49f0..457cab4ac41 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Pet.java @@ -283,7 +283,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 455300cd7f8..f866409c5bd 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -100,7 +100,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/SpecialModelName.java index ac1bfcbd846..2a7c39ec8e8 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -79,7 +79,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Tag.java index a95f8f4a4d8..9630d272242 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Tag.java @@ -109,7 +109,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 027702c3767..5232c14dbc3 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -202,7 +202,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2c8941f56e7..58d82e2d6fc 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -231,7 +231,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/User.java index 49ed08dff9a..ba6825df44e 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/User.java @@ -289,7 +289,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/XmlItem.java index 2ffd4927861..a68ed7a61d1 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/XmlItem.java @@ -994,7 +994,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 497124467a2..366143d1fc0 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesAnyType extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index d638cd95bf4..7a5e9587e65 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesArray extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 5ce0e7937f5..8f017af3507 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesBoolean extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index e133c0e8218..94d3394a381 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -447,7 +447,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index e7f70c5fb0d..8e85dd20fe7 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesInteger extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index e96cab6e53e..50db851ff00 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -83,7 +83,6 @@ public class AdditionalPropertiesNumber extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index fb48dd0c264..b6fcfc25ba8 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesObject extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 932cfecb044..20bbfd1117d 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -82,7 +82,6 @@ public class AdditionalPropertiesString extends HashMap { return Objects.hash(name, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java index 6f15310fd8c..c33e153c751 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java @@ -120,7 +120,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 366494a73a5..6f7b19e3be4 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 60a0c6bb707..18c4a58ef99 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -90,7 +90,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayTest.java index cf38d789167..41d2808a066 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -166,7 +166,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCat.java index c000e826f31..ccfdc5a5ec0 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCat.java @@ -125,7 +125,6 @@ public class BigCat extends Cat { return Objects.hash(kind, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 81a5b56ed64..481e22e0df1 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -118,7 +118,6 @@ public class BigCatAllOf { return Objects.hash(kind); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Capitalization.java index 27d2258b3fa..2065be194db 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Capitalization.java @@ -229,7 +229,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java index d04c3ecd1a5..10d8036c414 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java @@ -90,7 +90,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/CatAllOf.java index 153873956c9..38910bf5c69 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -79,7 +79,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java index ddd999f84c6..3737dbb3c3e 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java @@ -108,7 +108,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ClassModel.java index 3e2216e6ae4..227bdaae556 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ClassModel.java @@ -80,7 +80,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Client.java index 2147430592b..9fea8958838 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Client.java @@ -79,7 +79,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java index 559b170c4f7..d54ac1b7a2f 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java @@ -86,7 +86,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/DogAllOf.java index 9f3d303c1ab..449c4e6f051 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -79,7 +79,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumArrays.java index 6ed55a192bc..3836607265e 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -189,7 +189,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumTest.java index bc6ce93c566..7589d69aa6d 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumTest.java @@ -343,7 +343,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index bac6aa62f07..67596f2c9bd 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -119,7 +119,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FormatTest.java index aa437a6852f..fe1790374be 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FormatTest.java @@ -480,7 +480,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index bd976488179..4f7e8a75ca2 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -91,7 +91,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MapTest.java index ccb739e3bb8..dc0f170c75a 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MapTest.java @@ -239,7 +239,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index a8261ac47a5..c674dc908b7 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -153,7 +153,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Model200Response.java index 6bba2623f4b..bc3bee0e09a 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Model200Response.java @@ -110,7 +110,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 97921db1707..47f88db907b 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -139,7 +139,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelReturn.java index f28c2ac46ea..1b2a532f60c 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -80,7 +80,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Name.java index 7ba7d886ce2..1da9e1433c1 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Name.java @@ -151,7 +151,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NumberOnly.java index 54be0a4cbf0..d1f21fa5942 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -80,7 +80,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Order.java index d975c6afa6b..20ad6ca5d34 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Order.java @@ -267,7 +267,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/OuterComposite.java index bfea026235e..32db00927cb 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -140,7 +140,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Pet.java index 25d1f3c49f0..457cab4ac41 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Pet.java @@ -283,7 +283,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 455300cd7f8..f866409c5bd 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -100,7 +100,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/SpecialModelName.java index ac1bfcbd846..2a7c39ec8e8 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -79,7 +79,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Tag.java index a95f8f4a4d8..9630d272242 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Tag.java @@ -109,7 +109,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 027702c3767..5232c14dbc3 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -202,7 +202,6 @@ public class TypeHolderDefault { return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 2c8941f56e7..58d82e2d6fc 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -231,7 +231,6 @@ public class TypeHolderExample { return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/User.java index 49ed08dff9a..ba6825df44e 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/User.java @@ -289,7 +289,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/XmlItem.java index 2ffd4927861..a68ed7a61d1 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/XmlItem.java @@ -994,7 +994,6 @@ public class XmlItem { return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/ChildSchema.java b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/ChildSchema.java index d1c2e014f1d..8649a7b93cb 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/ChildSchema.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/ChildSchema.java @@ -134,7 +134,6 @@ public class ChildSchema extends Parent { return Objects.hash(prop1, super.hashCode(), additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/ChildSchemaAllOf.java b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/ChildSchemaAllOf.java index 34f7f810d16..a0db494b2ac 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/ChildSchemaAllOf.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/ChildSchemaAllOf.java @@ -84,7 +84,6 @@ public class ChildSchemaAllOf { return Objects.hash(prop1); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/MySchemaNameCharacters.java b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/MySchemaNameCharacters.java index 9e6139dd887..247c156a38d 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/MySchemaNameCharacters.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/MySchemaNameCharacters.java @@ -135,7 +135,6 @@ public class MySchemaNameCharacters extends Parent { return Objects.hash(prop2, super.hashCode(), additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/MySchemaNameCharactersAllOf.java b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/MySchemaNameCharactersAllOf.java index 35110aeb107..6cefaff7a87 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/MySchemaNameCharactersAllOf.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/MySchemaNameCharactersAllOf.java @@ -84,7 +84,6 @@ public class MySchemaNameCharactersAllOf { return Objects.hash(prop2); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/Parent.java b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/Parent.java index 858fa5368f6..2a382d5f2ac 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/Parent.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/model/Parent.java @@ -94,7 +94,6 @@ public class Parent { return Objects.hash(objectType); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index a75297dbd0a..f7c18aae8ba 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -335,7 +335,6 @@ public class AdditionalPropertiesClass { return Objects.hash(mapProperty, mapOfMapProperty, anytype1, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, emptyMap, mapWithUndeclaredPropertiesString); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java index 2a710f7c0eb..f15b1a4c09a 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java @@ -122,7 +122,6 @@ public class Animal { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Apple.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Apple.java index 1f5d097cf8c..118f51be938 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Apple.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Apple.java @@ -113,7 +113,6 @@ public class Apple { return Objects.hash(cultivar, origin); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AppleReq.java index 28d95b96a71..3e3ccfe74a1 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AppleReq.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AppleReq.java @@ -112,7 +112,6 @@ public class AppleReq { return Objects.hash(cultivar, mealy); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 61e776b5a47..9e5c4c6492f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -95,7 +95,6 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 57efee4d2d1..45fd7829c9e 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -95,7 +95,6 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java index d903e38a4c1..db796d93d47 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -169,7 +169,6 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Banana.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Banana.java index 435ba975ba4..41b4adf25cd 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Banana.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Banana.java @@ -85,7 +85,6 @@ public class Banana { return Objects.hash(lengthCm); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BananaReq.java index d8ace3f992d..a25e9a07081 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BananaReq.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BananaReq.java @@ -113,7 +113,6 @@ public class BananaReq { return Objects.hash(lengthCm, sweet); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BasquePig.java index 4c50d816384..96aff9e86b2 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BasquePig.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BasquePig.java @@ -83,7 +83,6 @@ public class BasquePig { return Objects.hash(className); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java index a9dea7ecdf0..e368f955e7d 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java @@ -229,7 +229,6 @@ public class Capitalization { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java index 0f8d0dcf912..387d3e0895e 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java @@ -133,7 +133,6 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode(), additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java index 03f58bfd5b1..54e6b24cdb0 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -84,7 +84,6 @@ public class CatAllOf { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java index ee4737e8d35..ea4ceb96ec0 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java @@ -112,7 +112,6 @@ public class Category { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCat.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCat.java index cef2ced4547..ad00f5688d2 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCat.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCat.java @@ -175,7 +175,6 @@ public class ChildCat extends ParentPet { return Objects.hash(name, petType, super.hashCode(), additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCatAllOf.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCatAllOf.java index 27f4ae52c63..1f574138ba2 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCatAllOf.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCatAllOf.java @@ -127,7 +127,6 @@ public class ChildCatAllOf { return Objects.hash(name, petType); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java index c8ae7f8a76e..700ba2f17b7 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java @@ -85,7 +85,6 @@ public class ClassModel { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java index dab78b57cd5..e7c0e00398d 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java @@ -84,7 +84,6 @@ public class Client { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java index 7242efd7262..347f19a0dba 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -155,7 +155,6 @@ public class ComplexQuadrilateral { return Objects.hash(shapeType, quadrilateralType, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DanishPig.java index 38db931baa9..dae0379e10e 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DanishPig.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DanishPig.java @@ -83,7 +83,6 @@ public class DanishPig { return Objects.hash(className); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java index 701a8f5827c..91826dae78d 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java @@ -133,7 +133,6 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode(), additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java index a9c704f742e..086058c0a71 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -84,7 +84,6 @@ public class DogAllOf { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Drawing.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Drawing.java index 642404cadff..ccae4aaacd6 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Drawing.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Drawing.java @@ -240,7 +240,6 @@ public class Drawing { return Objects.hash(mainShape, shapeOrNull, nullableShape, shapes, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java index 7dca4022c01..3ec9f891572 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -193,7 +193,6 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java index 23d81b39b41..fa8a5057851 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java @@ -447,7 +447,6 @@ public class EnumTest { return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EquilateralTriangle.java index b0a44657ed6..e5132c8288a 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EquilateralTriangle.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -155,7 +155,6 @@ public class EquilateralTriangle { return Objects.hash(shapeType, triangleType, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index accd424c2af..c60d469c297 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -123,7 +123,6 @@ public class FileSchemaTestClass { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Foo.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Foo.java index 0885ad1ece9..99776842253 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Foo.java @@ -84,7 +84,6 @@ public class Foo { return Objects.hash(bar); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java index ef56e32cd5b..5b6e671268e 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java @@ -530,7 +530,6 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, decimal, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GrandparentAnimal.java index 79973932509..0dbfc1f3721 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GrandparentAnimal.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -93,7 +93,6 @@ public class GrandparentAnimal { return Objects.hash(petType); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index c97c586db81..7bba0219b1c 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -97,7 +97,6 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HealthCheckResult.java index d12f679c227..3e67cd1c84c 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -98,7 +98,6 @@ public class HealthCheckResult { return Objects.hash(nullableMessage); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineResponseDefault.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineResponseDefault.java index 3fcd2852596..0295c474b2c 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineResponseDefault.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineResponseDefault.java @@ -85,7 +85,6 @@ public class InlineResponseDefault { return Objects.hash(string); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java index dac5aa412a4..de8014802d4 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -113,7 +113,6 @@ public class IsoscelesTriangle { return Objects.hash(shapeType, triangleType); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java index f1cc1f76952..82b45777945 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java @@ -241,7 +241,6 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 11744f59e90..1391207e425 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -156,7 +156,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java index 8dc189bc731..6f8ab9af771 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java @@ -114,7 +114,6 @@ public class Model200Response { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 6526672a02e..6fca2b9dcb6 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -142,7 +142,6 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java index a70aae4ecd8..00ca2754808 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -85,7 +85,6 @@ public class ModelReturn { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java index 6654394f0f9..40e242f6aba 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java @@ -155,7 +155,6 @@ public class Name { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java index 484a04c73a6..6590e167179 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java @@ -619,7 +619,6 @@ public class NullableClass { return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java index ccc4d7f9696..bfb345fc28f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -85,7 +85,6 @@ public class NumberOnly { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java index 0db344f33dc..712287864f0 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java @@ -267,7 +267,6 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java index 86250c03b98..f1425c4a848 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -143,7 +143,6 @@ public class OuterComposite { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ParentPet.java index c2f46eb7430..2e1e30212aa 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ParentPet.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ParentPet.java @@ -105,7 +105,6 @@ public class ParentPet extends GrandparentAnimal { return Objects.hash(super.hashCode(), additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java index 5749931544b..e9f52ee0bbb 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java @@ -281,7 +281,6 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java index 487f149f728..159eb442251 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -83,7 +83,6 @@ public class QuadrilateralInterface { return Objects.hash(quadrilateralType); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index e3a4e82ff20..22495675ccb 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -105,7 +105,6 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ScaleneTriangle.java index f5a662f9426..6508911dad5 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ScaleneTriangle.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -155,7 +155,6 @@ public class ScaleneTriangle { return Objects.hash(shapeType, triangleType, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeInterface.java index 3c2facc9feb..e44301b8d3d 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeInterface.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -83,7 +83,6 @@ public class ShapeInterface { return Objects.hash(shapeType); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java index 90094a2cf32..a665d55be01 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -155,7 +155,6 @@ public class SimpleQuadrilateral { return Objects.hash(shapeType, quadrilateralType, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java index 34db401c79f..f72fc3538e2 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -84,7 +84,6 @@ public class SpecialModelName { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java index 58d7e848629..9080c1b7b20 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java @@ -113,7 +113,6 @@ public class Tag { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TriangleInterface.java index 34ee4ba4bed..aee2904c270 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TriangleInterface.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -83,7 +83,6 @@ public class TriangleInterface { return Objects.hash(triangleType); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java index 4c2596ff335..3425d0068bd 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java @@ -436,7 +436,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, anyTypeProp, anyTypePropNullable); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Whale.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Whale.java index 903271b2308..ad576f50403 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Whale.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Whale.java @@ -141,7 +141,6 @@ public class Whale { return Objects.hash(hasBaleen, hasTeeth, className); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Zebra.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Zebra.java index d58401760d5..302896e9d9c 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Zebra.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Zebra.java @@ -191,7 +191,6 @@ public class Zebra { return Objects.hash(type, className, additionalProperties); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); From fb1b62816faa5fb0520caad7eb5248b0c9fe4c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Tue, 26 Jan 2021 13:23:09 +0900 Subject: [PATCH 44/54] [typescript-axios] reduce file size (#8283) * [typescript-axios] reduce file size * [typescript-axios] regenerate-samples --- .../TypeScriptAxiosClientCodegen.java | 1 + .../resources/typescript-axios/api.mustache | 2 + .../typescript-axios/apiInner.mustache | 70 +- .../typescript-axios/common.mustache | 120 ++++ .../composed-schemas/.openapi-generator/FILES | 1 + .../builds/composed-schemas/api.ts | 94 +-- .../builds/composed-schemas/common.ts | 131 ++++ .../builds/default/.openapi-generator/FILES | 1 + .../typescript-axios/builds/default/api.ts | 647 +++++------------- .../typescript-axios/builds/default/common.ts | 131 ++++ .../es6-target/.openapi-generator/FILES | 1 + .../typescript-axios/builds/es6-target/api.ts | 647 +++++------------- .../builds/es6-target/common.ts | 131 ++++ .../.openapi-generator/FILES | 1 + .../builds/with-complex-headers/api.ts | 647 +++++------------- .../builds/with-complex-headers/common.ts | 131 ++++ .../with-interfaces/.openapi-generator/FILES | 1 + .../builds/with-interfaces/api.ts | 647 +++++------------- .../builds/with-interfaces/common.ts | 131 ++++ .../.openapi-generator/FILES | 1 + .../api/another/level/pet-api.ts | 284 ++------ .../api/another/level/store-api.ts | 119 +--- .../api/another/level/user-api.ts | 248 ++----- .../common.ts | 131 ++++ .../with-npm-version/.openapi-generator/FILES | 1 + .../builds/with-npm-version/api.ts | 647 +++++------------- .../builds/with-npm-version/common.ts | 131 ++++ .../.openapi-generator/FILES | 1 + .../with-single-request-parameters/api.ts | 643 +++++------------ .../with-single-request-parameters/common.ts | 131 ++++ 30 files changed, 2372 insertions(+), 3500 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/typescript-axios/common.mustache create mode 100644 samples/client/petstore/typescript-axios/builds/composed-schemas/common.ts create mode 100644 samples/client/petstore/typescript-axios/builds/default/common.ts create mode 100644 samples/client/petstore/typescript-axios/builds/es6-target/common.ts create mode 100644 samples/client/petstore/typescript-axios/builds/with-complex-headers/common.ts create mode 100644 samples/client/petstore/typescript-axios/builds/with-interfaces/common.ts create mode 100644 samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/common.ts create mode 100644 samples/client/petstore/typescript-axios/builds/with-npm-version/common.ts create mode 100644 samples/client/petstore/typescript-axios/builds/with-single-request-parameters/common.ts diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java index cbadf484409..cc4eb8e0085 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java @@ -104,6 +104,7 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege supportingFiles.add(new SupportingFile("index.mustache", "", "index.ts")); supportingFiles.add(new SupportingFile("baseApi.mustache", "", "base.ts")); + supportingFiles.add(new SupportingFile("common.mustache", "", "common.ts")); supportingFiles.add(new SupportingFile("api.mustache", "", "api.ts")); supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.ts")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache index a723da26004..da873845d8a 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache @@ -7,6 +7,8 @@ import { Configuration } from './configuration'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; {{#models}} diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache index b8321a3f41f..71981cf8fca 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache @@ -7,6 +7,8 @@ import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; import { Configuration } from '{{apiRelativeToRoot}}configuration'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '{{apiRelativeToRoot}}common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base'; {{#imports}} // @ts-ignore @@ -39,15 +41,13 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur {{#allParams}} {{#required}} // verify required parameter '{{paramName}}' is not null or undefined - if ({{paramName}} === null || {{paramName}} === undefined) { - throw new RequiredError('{{paramName}}','Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); - } + assertParamExists('{{nickname}}', '{{paramName}}', {{paramName}}) {{/required}} {{/allParams}} const localVarPath = `{{{path}}}`{{#pathParams}} .replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}}; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -62,45 +62,23 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur // authentication {{name}} required {{#isApiKey}} {{#isKeyInHeader}} - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("{{keyParamName}}") - : await configuration.apiKey; - localVarHeaderParameter["{{keyParamName}}"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "{{keyParamName}}", configuration) {{/isKeyInHeader}} {{#isKeyInQuery}} - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("{{keyParamName}}") - : await configuration.apiKey; - localVarQueryParameter["{{keyParamName}}"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarQueryParameter, "{{keyParamName}}", configuration) {{/isKeyInQuery}} {{/isApiKey}} {{#isBasicBasic}} // http basic authentication required - if (configuration && (configuration.username || configuration.password)) { - localVarRequestOptions["auth"] = { username: configuration.username, password: configuration.password }; - } + setBasicAuthToObject(localVarRequestOptions, configuration) {{/isBasicBasic}} {{#isBasicBearer}} // http bearer authentication required - if (configuration && configuration.accessToken) { - const accessToken = typeof configuration.accessToken === 'function' - ? await configuration.accessToken() - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + accessToken; - } + await setBearerAuthToObject(localVarHeaderParameter, configuration) {{/isBasicBearer}} {{#isOAuth}} // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}], configuration) {{/isOAuth}} {{/authMethods}} @@ -188,31 +166,18 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur {{/consumes.0}} {{/bodyParam}} - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; {{#hasFormParams}} localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}}; {{/hasFormParams}} {{#bodyParam}} - const nonString = typeof {{paramName}} !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify({{paramName}} !== undefined ? {{paramName}} : {}) - : ({{paramName}} || ""); + localVarRequestOptions.data = serializeDataIfNeeded({{paramName}}, localVarRequestOptions, configuration) {{/bodyParam}} return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -226,6 +191,7 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur * @export */ export const {{classname}}Fp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = {{classname}}AxiosParamCreator(configuration) return { {{#operation}} /** @@ -240,11 +206,8 @@ export const {{classname}}Fp = function(configuration?: Configuration) { * @throws {RequiredError} */ async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>> { - const localVarAxiosArgs = await {{classname}}AxiosParamCreator(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, {{/operation}} } @@ -256,6 +219,7 @@ export const {{classname}}Fp = function(configuration?: Configuration) { * @export */ export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = {{classname}}Fp(configuration) return { {{#operation}} /** @@ -270,7 +234,7 @@ export const {{classname}}Factory = function (configuration?: Configuration, bas * @throws {RequiredError} */ {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> { - return {{classname}}Fp(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(axios, basePath)); + return localVarFp.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(axios, basePath)); }, {{/operation}} }; diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache new file mode 100644 index 00000000000..2e0578c2a2e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache @@ -0,0 +1,120 @@ +/* tslint:disable */ +/* eslint-disable */ +{{>licenseInfo}} + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/samples/client/petstore/typescript-axios/builds/composed-schemas/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/composed-schemas/.openapi-generator/FILES index 5bef353ae38..a80cd4f07b0 100644 --- a/samples/client/petstore/typescript-axios/builds/composed-schemas/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-axios/builds/composed-schemas/.openapi-generator/FILES @@ -2,6 +2,7 @@ .npmignore api.ts base.ts +common.ts configuration.ts git_push.sh index.ts diff --git a/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts b/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts index 20e496d94b0..0de89784bd0 100644 --- a/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts +++ b/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts @@ -17,6 +17,8 @@ import { Configuration } from './configuration'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; /** @@ -196,7 +198,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati filePost: async (inlineObject?: InlineObject, options: any = {}): Promise => { const localVarPath = `/file`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -210,26 +212,13 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof inlineObject !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(inlineObject !== undefined ? inlineObject : {}) - : (inlineObject || ""); + localVarRequestOptions.data = serializeDataIfNeeded(inlineObject, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -242,7 +231,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati petsFilteredPatch: async (petByAgePetByType?: PetByAge | PetByType, options: any = {}): Promise => { const localVarPath = `/pets-filtered`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -256,26 +245,13 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof petByAgePetByType !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(petByAgePetByType !== undefined ? petByAgePetByType : {}) - : (petByAgePetByType || ""); + localVarRequestOptions.data = serializeDataIfNeeded(petByAgePetByType, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -288,7 +264,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati petsPatch: async (catDog?: Cat | Dog, options: any = {}): Promise => { const localVarPath = `/pets`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -302,26 +278,13 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof catDog !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(catDog !== undefined ? catDog : {}) - : (catDog || ""); + localVarRequestOptions.data = serializeDataIfNeeded(catDog, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -333,6 +296,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @export */ export const DefaultApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration) return { /** * @@ -341,11 +305,8 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async filePost(inlineObject?: InlineObject, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).filePost(inlineObject, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.filePost(inlineObject, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -354,11 +315,8 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async petsFilteredPatch(petByAgePetByType?: PetByAge | PetByType, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).petsFilteredPatch(petByAgePetByType, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.petsFilteredPatch(petByAgePetByType, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -367,11 +325,8 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async petsPatch(catDog?: Cat | Dog, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).petsPatch(catDog, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.petsPatch(catDog, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -381,6 +336,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @export */ export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = DefaultApiFp(configuration) return { /** * @@ -389,7 +345,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa * @throws {RequiredError} */ filePost(inlineObject?: InlineObject, options?: any): AxiosPromise { - return DefaultApiFp(configuration).filePost(inlineObject, options).then((request) => request(axios, basePath)); + return localVarFp.filePost(inlineObject, options).then((request) => request(axios, basePath)); }, /** * @@ -398,7 +354,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa * @throws {RequiredError} */ petsFilteredPatch(petByAgePetByType?: PetByAge | PetByType, options?: any): AxiosPromise { - return DefaultApiFp(configuration).petsFilteredPatch(petByAgePetByType, options).then((request) => request(axios, basePath)); + return localVarFp.petsFilteredPatch(petByAgePetByType, options).then((request) => request(axios, basePath)); }, /** * @@ -407,7 +363,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa * @throws {RequiredError} */ petsPatch(catDog?: Cat | Dog, options?: any): AxiosPromise { - return DefaultApiFp(configuration).petsPatch(catDog, options).then((request) => request(axios, basePath)); + return localVarFp.petsPatch(catDog, options).then((request) => request(axios, basePath)); }, }; }; diff --git a/samples/client/petstore/typescript-axios/builds/composed-schemas/common.ts b/samples/client/petstore/typescript-axios/builds/composed-schemas/common.ts new file mode 100644 index 00000000000..261bfa1f444 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/composed-schemas/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/samples/client/petstore/typescript-axios/builds/default/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/default/.openapi-generator/FILES index 5bef353ae38..a80cd4f07b0 100644 --- a/samples/client/petstore/typescript-axios/builds/default/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-axios/builds/default/.openapi-generator/FILES @@ -2,6 +2,7 @@ .npmignore api.ts base.ts +common.ts configuration.ts git_push.sh index.ts diff --git a/samples/client/petstore/typescript-axios/builds/default/api.ts b/samples/client/petstore/typescript-axios/builds/default/api.ts index 1aca2afe908..856fb0a4829 100644 --- a/samples/client/petstore/typescript-axios/builds/default/api.ts +++ b/samples/client/petstore/typescript-axios/builds/default/api.ts @@ -17,6 +17,8 @@ import { Configuration } from './configuration'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; /** @@ -261,12 +263,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ addPet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.'); - } + assertParamExists('addPet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -278,37 +278,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -322,13 +304,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ deletePet: async (petId: number, apiKey?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); - } + assertParamExists('deletePet', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -340,12 +320,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (apiKey !== undefined && apiKey !== null) { localVarHeaderParameter['api_key'] = String(apiKey); @@ -353,19 +328,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -378,12 +346,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, options: any = {}): Promise => { // verify required parameter 'status' is not null or undefined - if (status === null || status === undefined) { - throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); - } + assertParamExists('findPetsByStatus', 'status', status) const localVarPath = `/pet/findByStatus`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -395,12 +361,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (status) { localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv); @@ -408,19 +369,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -433,12 +387,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByTags: async (tags: Array, options: any = {}): Promise => { // verify required parameter 'tags' is not null or undefined - if (tags === null || tags === undefined) { - throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); - } + assertParamExists('findPetsByTags', 'tags', tags) const localVarPath = `/pet/findByTags`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -450,12 +402,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (tags) { localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv); @@ -463,19 +410,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -488,13 +428,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ getPetById: async (petId: number, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); - } + assertParamExists('getPetById', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -505,28 +443,16 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -539,12 +465,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.'); - } + assertParamExists('updatePet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -556,37 +480,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -601,13 +507,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePetWithForm: async (petId: number, name?: string, status?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); - } + assertParamExists('updatePetWithForm', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -620,12 +524,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (name !== undefined) { @@ -639,20 +538,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams.toString(); return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -667,13 +559,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ uploadFile: async (petId: number, additionalMetadata?: string, file?: any, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); - } + assertParamExists('uploadFile', 'petId', petId) const localVarPath = `/pet/{petId}/uploadImage` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -686,12 +576,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (additionalMetadata !== undefined) { @@ -705,20 +590,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -730,6 +608,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const PetApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = PetApiAxiosParamCreator(configuration) return { /** * @@ -739,11 +618,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async addPet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).addPet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.addPet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -754,11 +630,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deletePet(petId: number, apiKey?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deletePet(petId, apiKey, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple status values can be provided with comma separated strings @@ -768,11 +641,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByStatus(status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -782,11 +652,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByTags(tags: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByTags(tags, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a single pet @@ -796,11 +663,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getPetById(petId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).getPetById(petId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getPetById(petId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -810,11 +674,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -826,11 +687,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePetWithForm(petId, name, status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -842,11 +700,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, additionalMetadata, file, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -856,6 +711,7 @@ export const PetApiFp = function(configuration?: Configuration) { * @export */ export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = PetApiFp(configuration) return { /** * @@ -865,7 +721,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ addPet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).addPet(body, options).then((request) => request(axios, basePath)); + return localVarFp.addPet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -876,7 +732,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ deletePet(petId: number, apiKey?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); + return localVarFp.deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); }, /** * Multiple status values can be provided with comma separated strings @@ -886,7 +742,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByStatus(status, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByStatus(status, options).then((request) => request(axios, basePath)); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -896,7 +752,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByTags(tags: Array, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByTags(tags, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByTags(tags, options).then((request) => request(axios, basePath)); }, /** * Returns a single pet @@ -906,7 +762,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ getPetById(petId: number, options?: any): AxiosPromise { - return PetApiFp(configuration).getPetById(petId, options).then((request) => request(axios, basePath)); + return localVarFp.getPetById(petId, options).then((request) => request(axios, basePath)); }, /** * @@ -916,7 +772,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePet(body, options).then((request) => request(axios, basePath)); + return localVarFp.updatePet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -928,7 +784,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePetWithForm(petId: number, name?: string, status?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); + return localVarFp.updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); }, /** * @@ -940,7 +796,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): AxiosPromise { - return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); + return localVarFp.uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); }, }; }; @@ -1070,13 +926,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ deleteOrder: async (orderId: string, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); - } + assertParamExists('deleteOrder', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1088,19 +942,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1113,7 +960,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration getInventory: async (options: any = {}): Promise => { const localVarPath = `/store/inventory`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1124,28 +971,16 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1158,13 +993,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ getOrderById: async (orderId: number, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); - } + assertParamExists('getOrderById', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1176,19 +1009,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1201,12 +1027,10 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ placeOrder: async (body: Order, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.'); - } + assertParamExists('placeOrder', 'body', body) const localVarPath = `/store/order`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1220,26 +1044,13 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1251,6 +1062,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration * @export */ export const StoreApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = StoreApiAxiosParamCreator(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1260,11 +1072,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteOrder(orderId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteOrder(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a map of status codes to quantities @@ -1273,11 +1082,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getInventory(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }>> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getInventory(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getInventory(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1287,11 +1093,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getOrderById(orderId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderById(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1301,11 +1104,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async placeOrder(body: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).placeOrder(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.placeOrder(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -1315,6 +1115,7 @@ export const StoreApiFp = function(configuration?: Configuration) { * @export */ export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = StoreApiFp(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1324,7 +1125,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ deleteOrder(orderId: string, options?: any): AxiosPromise { - return StoreApiFp(configuration).deleteOrder(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.deleteOrder(orderId, options).then((request) => request(axios, basePath)); }, /** * Returns a map of status codes to quantities @@ -1333,7 +1134,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getInventory(options?: any): AxiosPromise<{ [key: string]: number; }> { - return StoreApiFp(configuration).getInventory(options).then((request) => request(axios, basePath)); + return localVarFp.getInventory(options).then((request) => request(axios, basePath)); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1343,7 +1144,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getOrderById(orderId: number, options?: any): AxiosPromise { - return StoreApiFp(configuration).getOrderById(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.getOrderById(orderId, options).then((request) => request(axios, basePath)); }, /** * @@ -1353,7 +1154,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ placeOrder(body: Order, options?: any): AxiosPromise { - return StoreApiFp(configuration).placeOrder(body, options).then((request) => request(axios, basePath)); + return localVarFp.placeOrder(body, options).then((request) => request(axios, basePath)); }, }; }; @@ -1429,12 +1230,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUser: async (body: User, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.'); - } + assertParamExists('createUser', 'body', body) const localVarPath = `/user`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1448,26 +1247,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1480,12 +1266,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithArrayInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.'); - } + assertParamExists('createUsersWithArrayInput', 'body', body) const localVarPath = `/user/createWithArray`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1499,26 +1283,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1531,12 +1302,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithListInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.'); - } + assertParamExists('createUsersWithListInput', 'body', body) const localVarPath = `/user/createWithList`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1550,26 +1319,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1582,13 +1338,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ deleteUser: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); - } + assertParamExists('deleteUser', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1600,19 +1354,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1625,13 +1372,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ getUserByName: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); - } + assertParamExists('getUserByName', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1643,19 +1388,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1669,16 +1407,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ loginUser: async (username: string, password: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'username', username) // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'password', password) const localVarPath = `/user/login`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1698,19 +1432,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1723,7 +1450,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) logoutUser: async (options: any = {}): Promise => { const localVarPath = `/user/logout`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1735,19 +1462,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1761,17 +1481,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ updateUser: async (username: string, body: User, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'username', username) // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'body', body) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1785,26 +1501,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1816,6 +1519,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const UserApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = UserApiAxiosParamCreator(configuration) return { /** * This can only be done by the logged in user. @@ -1825,11 +1529,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUser(body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUser(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUser(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1839,11 +1540,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithArrayInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithArrayInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1853,11 +1551,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithListInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithListInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -1867,11 +1562,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteUser(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).deleteUser(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1881,11 +1573,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getUserByName(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).getUserByName(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserByName(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1896,11 +1585,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async loginUser(username: string, password: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).loginUser(username, password, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.loginUser(username, password, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1909,11 +1595,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async logoutUser(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).logoutUser(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.logoutUser(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -1924,11 +1607,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updateUser(username: string, body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).updateUser(username, body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser(username, body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -1938,6 +1618,7 @@ export const UserApiFp = function(configuration?: Configuration) { * @export */ export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = UserApiFp(configuration) return { /** * This can only be done by the logged in user. @@ -1947,7 +1628,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUser(body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).createUser(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUser(body, options).then((request) => request(axios, basePath)); }, /** * @@ -1957,7 +1638,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithArrayInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); }, /** * @@ -1967,7 +1648,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithListInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithListInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithListInput(body, options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -1977,7 +1658,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ deleteUser(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).deleteUser(username, options).then((request) => request(axios, basePath)); + return localVarFp.deleteUser(username, options).then((request) => request(axios, basePath)); }, /** * @@ -1987,7 +1668,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ getUserByName(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).getUserByName(username, options).then((request) => request(axios, basePath)); + return localVarFp.getUserByName(username, options).then((request) => request(axios, basePath)); }, /** * @@ -1998,7 +1679,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ loginUser(username: string, password: string, options?: any): AxiosPromise { - return UserApiFp(configuration).loginUser(username, password, options).then((request) => request(axios, basePath)); + return localVarFp.loginUser(username, password, options).then((request) => request(axios, basePath)); }, /** * @@ -2007,7 +1688,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ logoutUser(options?: any): AxiosPromise { - return UserApiFp(configuration).logoutUser(options).then((request) => request(axios, basePath)); + return localVarFp.logoutUser(options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -2018,7 +1699,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ updateUser(username: string, body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).updateUser(username, body, options).then((request) => request(axios, basePath)); + return localVarFp.updateUser(username, body, options).then((request) => request(axios, basePath)); }, }; }; diff --git a/samples/client/petstore/typescript-axios/builds/default/common.ts b/samples/client/petstore/typescript-axios/builds/default/common.ts new file mode 100644 index 00000000000..23e6a699c68 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/default/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator/FILES index 3a45f5700dd..534fae710fb 100644 --- a/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator/FILES @@ -3,6 +3,7 @@ README.md api.ts base.ts +common.ts configuration.ts git_push.sh index.ts diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/api.ts b/samples/client/petstore/typescript-axios/builds/es6-target/api.ts index 1aca2afe908..856fb0a4829 100644 --- a/samples/client/petstore/typescript-axios/builds/es6-target/api.ts +++ b/samples/client/petstore/typescript-axios/builds/es6-target/api.ts @@ -17,6 +17,8 @@ import { Configuration } from './configuration'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; /** @@ -261,12 +263,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ addPet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.'); - } + assertParamExists('addPet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -278,37 +278,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -322,13 +304,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ deletePet: async (petId: number, apiKey?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); - } + assertParamExists('deletePet', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -340,12 +320,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (apiKey !== undefined && apiKey !== null) { localVarHeaderParameter['api_key'] = String(apiKey); @@ -353,19 +328,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -378,12 +346,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, options: any = {}): Promise => { // verify required parameter 'status' is not null or undefined - if (status === null || status === undefined) { - throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); - } + assertParamExists('findPetsByStatus', 'status', status) const localVarPath = `/pet/findByStatus`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -395,12 +361,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (status) { localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv); @@ -408,19 +369,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -433,12 +387,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByTags: async (tags: Array, options: any = {}): Promise => { // verify required parameter 'tags' is not null or undefined - if (tags === null || tags === undefined) { - throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); - } + assertParamExists('findPetsByTags', 'tags', tags) const localVarPath = `/pet/findByTags`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -450,12 +402,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (tags) { localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv); @@ -463,19 +410,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -488,13 +428,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ getPetById: async (petId: number, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); - } + assertParamExists('getPetById', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -505,28 +443,16 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -539,12 +465,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.'); - } + assertParamExists('updatePet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -556,37 +480,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -601,13 +507,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePetWithForm: async (petId: number, name?: string, status?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); - } + assertParamExists('updatePetWithForm', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -620,12 +524,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (name !== undefined) { @@ -639,20 +538,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams.toString(); return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -667,13 +559,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ uploadFile: async (petId: number, additionalMetadata?: string, file?: any, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); - } + assertParamExists('uploadFile', 'petId', petId) const localVarPath = `/pet/{petId}/uploadImage` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -686,12 +576,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (additionalMetadata !== undefined) { @@ -705,20 +590,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -730,6 +608,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const PetApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = PetApiAxiosParamCreator(configuration) return { /** * @@ -739,11 +618,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async addPet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).addPet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.addPet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -754,11 +630,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deletePet(petId: number, apiKey?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deletePet(petId, apiKey, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple status values can be provided with comma separated strings @@ -768,11 +641,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByStatus(status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -782,11 +652,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByTags(tags: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByTags(tags, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a single pet @@ -796,11 +663,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getPetById(petId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).getPetById(petId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getPetById(petId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -810,11 +674,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -826,11 +687,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePetWithForm(petId, name, status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -842,11 +700,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, additionalMetadata, file, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -856,6 +711,7 @@ export const PetApiFp = function(configuration?: Configuration) { * @export */ export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = PetApiFp(configuration) return { /** * @@ -865,7 +721,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ addPet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).addPet(body, options).then((request) => request(axios, basePath)); + return localVarFp.addPet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -876,7 +732,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ deletePet(petId: number, apiKey?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); + return localVarFp.deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); }, /** * Multiple status values can be provided with comma separated strings @@ -886,7 +742,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByStatus(status, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByStatus(status, options).then((request) => request(axios, basePath)); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -896,7 +752,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByTags(tags: Array, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByTags(tags, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByTags(tags, options).then((request) => request(axios, basePath)); }, /** * Returns a single pet @@ -906,7 +762,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ getPetById(petId: number, options?: any): AxiosPromise { - return PetApiFp(configuration).getPetById(petId, options).then((request) => request(axios, basePath)); + return localVarFp.getPetById(petId, options).then((request) => request(axios, basePath)); }, /** * @@ -916,7 +772,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePet(body, options).then((request) => request(axios, basePath)); + return localVarFp.updatePet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -928,7 +784,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePetWithForm(petId: number, name?: string, status?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); + return localVarFp.updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); }, /** * @@ -940,7 +796,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): AxiosPromise { - return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); + return localVarFp.uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); }, }; }; @@ -1070,13 +926,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ deleteOrder: async (orderId: string, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); - } + assertParamExists('deleteOrder', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1088,19 +942,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1113,7 +960,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration getInventory: async (options: any = {}): Promise => { const localVarPath = `/store/inventory`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1124,28 +971,16 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1158,13 +993,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ getOrderById: async (orderId: number, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); - } + assertParamExists('getOrderById', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1176,19 +1009,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1201,12 +1027,10 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ placeOrder: async (body: Order, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.'); - } + assertParamExists('placeOrder', 'body', body) const localVarPath = `/store/order`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1220,26 +1044,13 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1251,6 +1062,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration * @export */ export const StoreApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = StoreApiAxiosParamCreator(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1260,11 +1072,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteOrder(orderId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteOrder(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a map of status codes to quantities @@ -1273,11 +1082,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getInventory(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }>> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getInventory(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getInventory(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1287,11 +1093,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getOrderById(orderId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderById(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1301,11 +1104,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async placeOrder(body: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).placeOrder(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.placeOrder(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -1315,6 +1115,7 @@ export const StoreApiFp = function(configuration?: Configuration) { * @export */ export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = StoreApiFp(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1324,7 +1125,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ deleteOrder(orderId: string, options?: any): AxiosPromise { - return StoreApiFp(configuration).deleteOrder(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.deleteOrder(orderId, options).then((request) => request(axios, basePath)); }, /** * Returns a map of status codes to quantities @@ -1333,7 +1134,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getInventory(options?: any): AxiosPromise<{ [key: string]: number; }> { - return StoreApiFp(configuration).getInventory(options).then((request) => request(axios, basePath)); + return localVarFp.getInventory(options).then((request) => request(axios, basePath)); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1343,7 +1144,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getOrderById(orderId: number, options?: any): AxiosPromise { - return StoreApiFp(configuration).getOrderById(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.getOrderById(orderId, options).then((request) => request(axios, basePath)); }, /** * @@ -1353,7 +1154,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ placeOrder(body: Order, options?: any): AxiosPromise { - return StoreApiFp(configuration).placeOrder(body, options).then((request) => request(axios, basePath)); + return localVarFp.placeOrder(body, options).then((request) => request(axios, basePath)); }, }; }; @@ -1429,12 +1230,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUser: async (body: User, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.'); - } + assertParamExists('createUser', 'body', body) const localVarPath = `/user`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1448,26 +1247,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1480,12 +1266,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithArrayInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.'); - } + assertParamExists('createUsersWithArrayInput', 'body', body) const localVarPath = `/user/createWithArray`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1499,26 +1283,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1531,12 +1302,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithListInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.'); - } + assertParamExists('createUsersWithListInput', 'body', body) const localVarPath = `/user/createWithList`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1550,26 +1319,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1582,13 +1338,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ deleteUser: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); - } + assertParamExists('deleteUser', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1600,19 +1354,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1625,13 +1372,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ getUserByName: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); - } + assertParamExists('getUserByName', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1643,19 +1388,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1669,16 +1407,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ loginUser: async (username: string, password: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'username', username) // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'password', password) const localVarPath = `/user/login`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1698,19 +1432,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1723,7 +1450,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) logoutUser: async (options: any = {}): Promise => { const localVarPath = `/user/logout`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1735,19 +1462,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1761,17 +1481,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ updateUser: async (username: string, body: User, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'username', username) // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'body', body) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1785,26 +1501,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1816,6 +1519,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const UserApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = UserApiAxiosParamCreator(configuration) return { /** * This can only be done by the logged in user. @@ -1825,11 +1529,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUser(body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUser(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUser(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1839,11 +1540,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithArrayInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithArrayInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1853,11 +1551,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithListInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithListInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -1867,11 +1562,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteUser(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).deleteUser(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1881,11 +1573,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getUserByName(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).getUserByName(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserByName(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1896,11 +1585,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async loginUser(username: string, password: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).loginUser(username, password, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.loginUser(username, password, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1909,11 +1595,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async logoutUser(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).logoutUser(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.logoutUser(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -1924,11 +1607,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updateUser(username: string, body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).updateUser(username, body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser(username, body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -1938,6 +1618,7 @@ export const UserApiFp = function(configuration?: Configuration) { * @export */ export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = UserApiFp(configuration) return { /** * This can only be done by the logged in user. @@ -1947,7 +1628,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUser(body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).createUser(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUser(body, options).then((request) => request(axios, basePath)); }, /** * @@ -1957,7 +1638,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithArrayInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); }, /** * @@ -1967,7 +1648,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithListInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithListInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithListInput(body, options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -1977,7 +1658,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ deleteUser(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).deleteUser(username, options).then((request) => request(axios, basePath)); + return localVarFp.deleteUser(username, options).then((request) => request(axios, basePath)); }, /** * @@ -1987,7 +1668,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ getUserByName(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).getUserByName(username, options).then((request) => request(axios, basePath)); + return localVarFp.getUserByName(username, options).then((request) => request(axios, basePath)); }, /** * @@ -1998,7 +1679,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ loginUser(username: string, password: string, options?: any): AxiosPromise { - return UserApiFp(configuration).loginUser(username, password, options).then((request) => request(axios, basePath)); + return localVarFp.loginUser(username, password, options).then((request) => request(axios, basePath)); }, /** * @@ -2007,7 +1688,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ logoutUser(options?: any): AxiosPromise { - return UserApiFp(configuration).logoutUser(options).then((request) => request(axios, basePath)); + return localVarFp.logoutUser(options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -2018,7 +1699,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ updateUser(username: string, body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).updateUser(username, body, options).then((request) => request(axios, basePath)); + return localVarFp.updateUser(username, body, options).then((request) => request(axios, basePath)); }, }; }; diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/common.ts b/samples/client/petstore/typescript-axios/builds/es6-target/common.ts new file mode 100644 index 00000000000..23e6a699c68 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/with-complex-headers/.openapi-generator/FILES index 5bef353ae38..a80cd4f07b0 100644 --- a/samples/client/petstore/typescript-axios/builds/with-complex-headers/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/.openapi-generator/FILES @@ -2,6 +2,7 @@ .npmignore api.ts base.ts +common.ts configuration.ts git_push.sh index.ts diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts b/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts index 9b2c0fd3fed..85c32a979e2 100644 --- a/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts @@ -17,6 +17,8 @@ import { Configuration } from './configuration'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; /** @@ -263,12 +265,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ addPet: async (pet: Pet, header1?: Pet, header2?: Array, options: any = {}): Promise => { // verify required parameter 'pet' is not null or undefined - if (pet === null || pet === undefined) { - throw new RequiredError('pet','Required parameter pet was null or undefined when calling addPet.'); - } + assertParamExists('addPet', 'pet', pet) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -280,12 +280,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (header1 !== undefined && header1 !== null) { localVarHeaderParameter['header1'] = String(JSON.stringify(header1)); @@ -300,26 +295,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof pet !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(pet !== undefined ? pet : {}) - : (pet || ""); + localVarRequestOptions.data = serializeDataIfNeeded(pet, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -333,13 +315,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ deletePet: async (petId: number, apiKey?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); - } + assertParamExists('deletePet', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -351,12 +331,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (apiKey !== undefined && apiKey !== null) { localVarHeaderParameter['api_key'] = String(apiKey); @@ -364,19 +339,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -389,12 +357,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, options: any = {}): Promise => { // verify required parameter 'status' is not null or undefined - if (status === null || status === undefined) { - throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); - } + assertParamExists('findPetsByStatus', 'status', status) const localVarPath = `/pet/findByStatus`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -406,12 +372,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (status) { localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv); @@ -419,19 +380,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -444,12 +398,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByTags: async (tags: Array, options: any = {}): Promise => { // verify required parameter 'tags' is not null or undefined - if (tags === null || tags === undefined) { - throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); - } + assertParamExists('findPetsByTags', 'tags', tags) const localVarPath = `/pet/findByTags`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -461,12 +413,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (tags) { localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv); @@ -474,19 +421,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -499,13 +439,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ getPetById: async (petId: number, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); - } + assertParamExists('getPetById', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -516,28 +454,16 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -550,12 +476,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePet: async (pet: Pet, options: any = {}): Promise => { // verify required parameter 'pet' is not null or undefined - if (pet === null || pet === undefined) { - throw new RequiredError('pet','Required parameter pet was null or undefined when calling updatePet.'); - } + assertParamExists('updatePet', 'pet', pet) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -567,37 +491,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof pet !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(pet !== undefined ? pet : {}) - : (pet || ""); + localVarRequestOptions.data = serializeDataIfNeeded(pet, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -612,13 +518,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePetWithForm: async (petId: number, name?: string, status?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); - } + assertParamExists('updatePetWithForm', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -631,12 +535,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (name !== undefined) { @@ -650,20 +549,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams.toString(); return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -678,13 +570,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ uploadFile: async (petId: number, additionalMetadata?: string, file?: any, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); - } + assertParamExists('uploadFile', 'petId', petId) const localVarPath = `/pet/{petId}/uploadImage` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -697,12 +587,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (additionalMetadata !== undefined) { @@ -716,20 +601,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -741,6 +619,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const PetApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = PetApiAxiosParamCreator(configuration) return { /** * @@ -752,11 +631,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async addPet(pet: Pet, header1?: Pet, header2?: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).addPet(pet, header1, header2, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.addPet(pet, header1, header2, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -767,11 +643,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deletePet(petId: number, apiKey?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deletePet(petId, apiKey, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple status values can be provided with comma separated strings @@ -781,11 +654,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByStatus(status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -795,11 +665,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByTags(tags: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByTags(tags, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a single pet @@ -809,11 +676,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getPetById(petId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).getPetById(petId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getPetById(petId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -823,11 +687,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePet(pet: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePet(pet, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePet(pet, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -839,11 +700,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePetWithForm(petId, name, status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -855,11 +713,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, additionalMetadata, file, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -869,6 +724,7 @@ export const PetApiFp = function(configuration?: Configuration) { * @export */ export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = PetApiFp(configuration) return { /** * @@ -880,7 +736,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ addPet(pet: Pet, header1?: Pet, header2?: Array, options?: any): AxiosPromise { - return PetApiFp(configuration).addPet(pet, header1, header2, options).then((request) => request(axios, basePath)); + return localVarFp.addPet(pet, header1, header2, options).then((request) => request(axios, basePath)); }, /** * @@ -891,7 +747,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ deletePet(petId: number, apiKey?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); + return localVarFp.deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); }, /** * Multiple status values can be provided with comma separated strings @@ -901,7 +757,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByStatus(status, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByStatus(status, options).then((request) => request(axios, basePath)); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -911,7 +767,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByTags(tags: Array, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByTags(tags, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByTags(tags, options).then((request) => request(axios, basePath)); }, /** * Returns a single pet @@ -921,7 +777,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ getPetById(petId: number, options?: any): AxiosPromise { - return PetApiFp(configuration).getPetById(petId, options).then((request) => request(axios, basePath)); + return localVarFp.getPetById(petId, options).then((request) => request(axios, basePath)); }, /** * @@ -931,7 +787,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePet(pet: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePet(pet, options).then((request) => request(axios, basePath)); + return localVarFp.updatePet(pet, options).then((request) => request(axios, basePath)); }, /** * @@ -943,7 +799,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePetWithForm(petId: number, name?: string, status?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); + return localVarFp.updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); }, /** * @@ -955,7 +811,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): AxiosPromise { - return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); + return localVarFp.uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); }, }; }; @@ -1087,13 +943,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ deleteOrder: async (orderId: string, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); - } + assertParamExists('deleteOrder', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1105,19 +959,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1130,7 +977,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration getInventory: async (options: any = {}): Promise => { const localVarPath = `/store/inventory`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1141,28 +988,16 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1175,13 +1010,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ getOrderById: async (orderId: number, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); - } + assertParamExists('getOrderById', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1193,19 +1026,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1218,12 +1044,10 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ placeOrder: async (order: Order, options: any = {}): Promise => { // verify required parameter 'order' is not null or undefined - if (order === null || order === undefined) { - throw new RequiredError('order','Required parameter order was null or undefined when calling placeOrder.'); - } + assertParamExists('placeOrder', 'order', order) const localVarPath = `/store/order`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1237,26 +1061,13 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof order !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(order !== undefined ? order : {}) - : (order || ""); + localVarRequestOptions.data = serializeDataIfNeeded(order, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1268,6 +1079,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration * @export */ export const StoreApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = StoreApiAxiosParamCreator(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1277,11 +1089,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteOrder(orderId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteOrder(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a map of status codes to quantities @@ -1290,11 +1099,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getInventory(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }>> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getInventory(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getInventory(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1304,11 +1110,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getOrderById(orderId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderById(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1318,11 +1121,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async placeOrder(order: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).placeOrder(order, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.placeOrder(order, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -1332,6 +1132,7 @@ export const StoreApiFp = function(configuration?: Configuration) { * @export */ export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = StoreApiFp(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1341,7 +1142,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ deleteOrder(orderId: string, options?: any): AxiosPromise { - return StoreApiFp(configuration).deleteOrder(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.deleteOrder(orderId, options).then((request) => request(axios, basePath)); }, /** * Returns a map of status codes to quantities @@ -1350,7 +1151,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getInventory(options?: any): AxiosPromise<{ [key: string]: number; }> { - return StoreApiFp(configuration).getInventory(options).then((request) => request(axios, basePath)); + return localVarFp.getInventory(options).then((request) => request(axios, basePath)); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1360,7 +1161,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getOrderById(orderId: number, options?: any): AxiosPromise { - return StoreApiFp(configuration).getOrderById(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.getOrderById(orderId, options).then((request) => request(axios, basePath)); }, /** * @@ -1370,7 +1171,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ placeOrder(order: Order, options?: any): AxiosPromise { - return StoreApiFp(configuration).placeOrder(order, options).then((request) => request(axios, basePath)); + return localVarFp.placeOrder(order, options).then((request) => request(axios, basePath)); }, }; }; @@ -1446,12 +1247,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUser: async (user: User, options: any = {}): Promise => { // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new RequiredError('user','Required parameter user was null or undefined when calling createUser.'); - } + assertParamExists('createUser', 'user', user) const localVarPath = `/user`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1465,26 +1264,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof user !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(user !== undefined ? user : {}) - : (user || ""); + localVarRequestOptions.data = serializeDataIfNeeded(user, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1497,12 +1283,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithArrayInput: async (user: Array, options: any = {}): Promise => { // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithArrayInput.'); - } + assertParamExists('createUsersWithArrayInput', 'user', user) const localVarPath = `/user/createWithArray`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1516,26 +1300,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof user !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(user !== undefined ? user : {}) - : (user || ""); + localVarRequestOptions.data = serializeDataIfNeeded(user, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1548,12 +1319,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithListInput: async (user: Array, options: any = {}): Promise => { // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithListInput.'); - } + assertParamExists('createUsersWithListInput', 'user', user) const localVarPath = `/user/createWithList`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1567,26 +1336,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof user !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(user !== undefined ? user : {}) - : (user || ""); + localVarRequestOptions.data = serializeDataIfNeeded(user, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1599,13 +1355,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ deleteUser: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); - } + assertParamExists('deleteUser', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1617,19 +1371,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1642,13 +1389,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ getUserByName: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); - } + assertParamExists('getUserByName', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1660,19 +1405,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1686,16 +1424,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ loginUser: async (username: string, password: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'username', username) // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'password', password) const localVarPath = `/user/login`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1715,19 +1449,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1740,7 +1467,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) logoutUser: async (options: any = {}): Promise => { const localVarPath = `/user/logout`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1752,19 +1479,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1778,17 +1498,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ updateUser: async (username: string, user: User, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'username', username) // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new RequiredError('user','Required parameter user was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'user', user) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1802,26 +1518,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof user !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(user !== undefined ? user : {}) - : (user || ""); + localVarRequestOptions.data = serializeDataIfNeeded(user, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1833,6 +1536,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const UserApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = UserApiAxiosParamCreator(configuration) return { /** * This can only be done by the logged in user. @@ -1842,11 +1546,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUser(user: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUser(user, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUser(user, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1856,11 +1557,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithArrayInput(user: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithArrayInput(user, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1870,11 +1568,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithListInput(user: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithListInput(user, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -1884,11 +1579,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteUser(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).deleteUser(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1898,11 +1590,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getUserByName(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).getUserByName(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserByName(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1913,11 +1602,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async loginUser(username: string, password: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).loginUser(username, password, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.loginUser(username, password, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1926,11 +1612,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async logoutUser(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).logoutUser(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.logoutUser(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -1941,11 +1624,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updateUser(username: string, user: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).updateUser(username, user, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser(username, user, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -1955,6 +1635,7 @@ export const UserApiFp = function(configuration?: Configuration) { * @export */ export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = UserApiFp(configuration) return { /** * This can only be done by the logged in user. @@ -1964,7 +1645,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUser(user: User, options?: any): AxiosPromise { - return UserApiFp(configuration).createUser(user, options).then((request) => request(axios, basePath)); + return localVarFp.createUser(user, options).then((request) => request(axios, basePath)); }, /** * @@ -1974,7 +1655,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithArrayInput(user: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithArrayInput(user, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithArrayInput(user, options).then((request) => request(axios, basePath)); }, /** * @@ -1984,7 +1665,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithListInput(user: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithListInput(user, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithListInput(user, options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -1994,7 +1675,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ deleteUser(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).deleteUser(username, options).then((request) => request(axios, basePath)); + return localVarFp.deleteUser(username, options).then((request) => request(axios, basePath)); }, /** * @@ -2004,7 +1685,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ getUserByName(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).getUserByName(username, options).then((request) => request(axios, basePath)); + return localVarFp.getUserByName(username, options).then((request) => request(axios, basePath)); }, /** * @@ -2015,7 +1696,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ loginUser(username: string, password: string, options?: any): AxiosPromise { - return UserApiFp(configuration).loginUser(username, password, options).then((request) => request(axios, basePath)); + return localVarFp.loginUser(username, password, options).then((request) => request(axios, basePath)); }, /** * @@ -2024,7 +1705,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ logoutUser(options?: any): AxiosPromise { - return UserApiFp(configuration).logoutUser(options).then((request) => request(axios, basePath)); + return localVarFp.logoutUser(options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -2035,7 +1716,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ updateUser(username: string, user: User, options?: any): AxiosPromise { - return UserApiFp(configuration).updateUser(username, user, options).then((request) => request(axios, basePath)); + return localVarFp.updateUser(username, user, options).then((request) => request(axios, basePath)); }, }; }; diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/common.ts b/samples/client/petstore/typescript-axios/builds/with-complex-headers/common.ts new file mode 100644 index 00000000000..23e6a699c68 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator/FILES index 5bef353ae38..a80cd4f07b0 100644 --- a/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator/FILES @@ -2,6 +2,7 @@ .npmignore api.ts base.ts +common.ts configuration.ts git_push.sh index.ts diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts index 132c7cc9635..0368b1d5703 100644 --- a/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts @@ -17,6 +17,8 @@ import { Configuration } from './configuration'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; /** @@ -261,12 +263,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ addPet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.'); - } + assertParamExists('addPet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -278,37 +278,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -322,13 +304,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ deletePet: async (petId: number, apiKey?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); - } + assertParamExists('deletePet', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -340,12 +320,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (apiKey !== undefined && apiKey !== null) { localVarHeaderParameter['api_key'] = String(apiKey); @@ -353,19 +328,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -378,12 +346,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, options: any = {}): Promise => { // verify required parameter 'status' is not null or undefined - if (status === null || status === undefined) { - throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); - } + assertParamExists('findPetsByStatus', 'status', status) const localVarPath = `/pet/findByStatus`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -395,12 +361,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (status) { localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv); @@ -408,19 +369,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -433,12 +387,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByTags: async (tags: Array, options: any = {}): Promise => { // verify required parameter 'tags' is not null or undefined - if (tags === null || tags === undefined) { - throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); - } + assertParamExists('findPetsByTags', 'tags', tags) const localVarPath = `/pet/findByTags`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -450,12 +402,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (tags) { localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv); @@ -463,19 +410,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -488,13 +428,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ getPetById: async (petId: number, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); - } + assertParamExists('getPetById', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -505,28 +443,16 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -539,12 +465,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.'); - } + assertParamExists('updatePet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -556,37 +480,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -601,13 +507,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePetWithForm: async (petId: number, name?: string, status?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); - } + assertParamExists('updatePetWithForm', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -620,12 +524,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (name !== undefined) { @@ -639,20 +538,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams.toString(); return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -667,13 +559,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ uploadFile: async (petId: number, additionalMetadata?: string, file?: any, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); - } + assertParamExists('uploadFile', 'petId', petId) const localVarPath = `/pet/{petId}/uploadImage` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -686,12 +576,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (additionalMetadata !== undefined) { @@ -705,20 +590,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -730,6 +608,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const PetApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = PetApiAxiosParamCreator(configuration) return { /** * @@ -739,11 +618,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async addPet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).addPet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.addPet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -754,11 +630,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deletePet(petId: number, apiKey?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deletePet(petId, apiKey, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple status values can be provided with comma separated strings @@ -768,11 +641,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByStatus(status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -782,11 +652,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByTags(tags: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByTags(tags, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a single pet @@ -796,11 +663,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getPetById(petId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).getPetById(petId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getPetById(petId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -810,11 +674,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -826,11 +687,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePetWithForm(petId, name, status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -842,11 +700,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, additionalMetadata, file, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -856,6 +711,7 @@ export const PetApiFp = function(configuration?: Configuration) { * @export */ export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = PetApiFp(configuration) return { /** * @@ -865,7 +721,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ addPet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).addPet(body, options).then((request) => request(axios, basePath)); + return localVarFp.addPet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -876,7 +732,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ deletePet(petId: number, apiKey?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); + return localVarFp.deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); }, /** * Multiple status values can be provided with comma separated strings @@ -886,7 +742,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByStatus(status, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByStatus(status, options).then((request) => request(axios, basePath)); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -896,7 +752,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByTags(tags: Array, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByTags(tags, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByTags(tags, options).then((request) => request(axios, basePath)); }, /** * Returns a single pet @@ -906,7 +762,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ getPetById(petId: number, options?: any): AxiosPromise { - return PetApiFp(configuration).getPetById(petId, options).then((request) => request(axios, basePath)); + return localVarFp.getPetById(petId, options).then((request) => request(axios, basePath)); }, /** * @@ -916,7 +772,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePet(body, options).then((request) => request(axios, basePath)); + return localVarFp.updatePet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -928,7 +784,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePetWithForm(petId: number, name?: string, status?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); + return localVarFp.updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); }, /** * @@ -940,7 +796,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): AxiosPromise { - return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); + return localVarFp.uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); }, }; }; @@ -1163,13 +1019,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ deleteOrder: async (orderId: string, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); - } + assertParamExists('deleteOrder', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1181,19 +1035,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1206,7 +1053,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration getInventory: async (options: any = {}): Promise => { const localVarPath = `/store/inventory`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1217,28 +1064,16 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1251,13 +1086,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ getOrderById: async (orderId: number, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); - } + assertParamExists('getOrderById', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1269,19 +1102,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1294,12 +1120,10 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ placeOrder: async (body: Order, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.'); - } + assertParamExists('placeOrder', 'body', body) const localVarPath = `/store/order`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1313,26 +1137,13 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1344,6 +1155,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration * @export */ export const StoreApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = StoreApiAxiosParamCreator(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1353,11 +1165,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteOrder(orderId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteOrder(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a map of status codes to quantities @@ -1366,11 +1175,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getInventory(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }>> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getInventory(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getInventory(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1380,11 +1186,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getOrderById(orderId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderById(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1394,11 +1197,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async placeOrder(body: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).placeOrder(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.placeOrder(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -1408,6 +1208,7 @@ export const StoreApiFp = function(configuration?: Configuration) { * @export */ export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = StoreApiFp(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1417,7 +1218,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ deleteOrder(orderId: string, options?: any): AxiosPromise { - return StoreApiFp(configuration).deleteOrder(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.deleteOrder(orderId, options).then((request) => request(axios, basePath)); }, /** * Returns a map of status codes to quantities @@ -1426,7 +1227,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getInventory(options?: any): AxiosPromise<{ [key: string]: number; }> { - return StoreApiFp(configuration).getInventory(options).then((request) => request(axios, basePath)); + return localVarFp.getInventory(options).then((request) => request(axios, basePath)); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1436,7 +1237,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getOrderById(orderId: number, options?: any): AxiosPromise { - return StoreApiFp(configuration).getOrderById(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.getOrderById(orderId, options).then((request) => request(axios, basePath)); }, /** * @@ -1446,7 +1247,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ placeOrder(body: Order, options?: any): AxiosPromise { - return StoreApiFp(configuration).placeOrder(body, options).then((request) => request(axios, basePath)); + return localVarFp.placeOrder(body, options).then((request) => request(axios, basePath)); }, }; }; @@ -1569,12 +1370,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUser: async (body: User, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.'); - } + assertParamExists('createUser', 'body', body) const localVarPath = `/user`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1588,26 +1387,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1620,12 +1406,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithArrayInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.'); - } + assertParamExists('createUsersWithArrayInput', 'body', body) const localVarPath = `/user/createWithArray`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1639,26 +1423,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1671,12 +1442,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithListInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.'); - } + assertParamExists('createUsersWithListInput', 'body', body) const localVarPath = `/user/createWithList`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1690,26 +1459,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1722,13 +1478,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ deleteUser: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); - } + assertParamExists('deleteUser', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1740,19 +1494,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1765,13 +1512,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ getUserByName: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); - } + assertParamExists('getUserByName', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1783,19 +1528,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1809,16 +1547,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ loginUser: async (username: string, password: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'username', username) // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'password', password) const localVarPath = `/user/login`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1838,19 +1572,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1863,7 +1590,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) logoutUser: async (options: any = {}): Promise => { const localVarPath = `/user/logout`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1875,19 +1602,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1901,17 +1621,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ updateUser: async (username: string, body: User, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'username', username) // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'body', body) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1925,26 +1641,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1956,6 +1659,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const UserApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = UserApiAxiosParamCreator(configuration) return { /** * This can only be done by the logged in user. @@ -1965,11 +1669,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUser(body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUser(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUser(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1979,11 +1680,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithArrayInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithArrayInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1993,11 +1691,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithListInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithListInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -2007,11 +1702,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteUser(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).deleteUser(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -2021,11 +1713,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getUserByName(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).getUserByName(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserByName(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -2036,11 +1725,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async loginUser(username: string, password: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).loginUser(username, password, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.loginUser(username, password, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -2049,11 +1735,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async logoutUser(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).logoutUser(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.logoutUser(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -2064,11 +1747,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updateUser(username: string, body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).updateUser(username, body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser(username, body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -2078,6 +1758,7 @@ export const UserApiFp = function(configuration?: Configuration) { * @export */ export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = UserApiFp(configuration) return { /** * This can only be done by the logged in user. @@ -2087,7 +1768,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUser(body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).createUser(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUser(body, options).then((request) => request(axios, basePath)); }, /** * @@ -2097,7 +1778,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithArrayInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); }, /** * @@ -2107,7 +1788,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithListInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithListInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithListInput(body, options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -2117,7 +1798,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ deleteUser(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).deleteUser(username, options).then((request) => request(axios, basePath)); + return localVarFp.deleteUser(username, options).then((request) => request(axios, basePath)); }, /** * @@ -2127,7 +1808,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ getUserByName(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).getUserByName(username, options).then((request) => request(axios, basePath)); + return localVarFp.getUserByName(username, options).then((request) => request(axios, basePath)); }, /** * @@ -2138,7 +1819,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ loginUser(username: string, password: string, options?: any): AxiosPromise { - return UserApiFp(configuration).loginUser(username, password, options).then((request) => request(axios, basePath)); + return localVarFp.loginUser(username, password, options).then((request) => request(axios, basePath)); }, /** * @@ -2147,7 +1828,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ logoutUser(options?: any): AxiosPromise { - return UserApiFp(configuration).logoutUser(options).then((request) => request(axios, basePath)); + return localVarFp.logoutUser(options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -2158,7 +1839,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ updateUser(username: string, body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).updateUser(username, body, options).then((request) => request(axios, basePath)); + return localVarFp.updateUser(username, body, options).then((request) => request(axios, basePath)); }, }; }; diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/common.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces/common.ts new file mode 100644 index 00000000000..23e6a699c68 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/.openapi-generator/FILES index 94156a16c6b..aded8aa37a1 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/.openapi-generator/FILES @@ -6,6 +6,7 @@ api/another/level/pet-api.ts api/another/level/store-api.ts api/another/level/user-api.ts base.ts +common.ts configuration.ts git_push.sh index.ts diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts index 338ebcd3fc4..fc66c5184fa 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts @@ -17,6 +17,8 @@ import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; import { Configuration } from '../../../configuration'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../../../common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base'; // @ts-ignore import { ApiResponse } from '../../../model/some/levels/deep'; @@ -37,12 +39,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ addPet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.'); - } + assertParamExists('addPet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -54,37 +54,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -98,13 +80,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ deletePet: async (petId: number, apiKey?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); - } + assertParamExists('deletePet', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -116,12 +96,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (apiKey !== undefined && apiKey !== null) { localVarHeaderParameter['api_key'] = String(apiKey); @@ -129,19 +104,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -154,12 +122,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, options: any = {}): Promise => { // verify required parameter 'status' is not null or undefined - if (status === null || status === undefined) { - throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); - } + assertParamExists('findPetsByStatus', 'status', status) const localVarPath = `/pet/findByStatus`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -171,12 +137,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (status) { localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv); @@ -184,19 +145,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -209,12 +163,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByTags: async (tags: Array, options: any = {}): Promise => { // verify required parameter 'tags' is not null or undefined - if (tags === null || tags === undefined) { - throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); - } + assertParamExists('findPetsByTags', 'tags', tags) const localVarPath = `/pet/findByTags`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -226,12 +178,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (tags) { localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv); @@ -239,19 +186,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -264,13 +204,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ getPetById: async (petId: number, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); - } + assertParamExists('getPetById', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -281,28 +219,16 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -315,12 +241,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.'); - } + assertParamExists('updatePet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -332,37 +256,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -377,13 +283,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePetWithForm: async (petId: number, name?: string, status?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); - } + assertParamExists('updatePetWithForm', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -396,12 +300,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (name !== undefined) { @@ -415,20 +314,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams.toString(); return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -443,13 +335,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ uploadFile: async (petId: number, additionalMetadata?: string, file?: any, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); - } + assertParamExists('uploadFile', 'petId', petId) const localVarPath = `/pet/{petId}/uploadImage` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -462,12 +352,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (additionalMetadata !== undefined) { @@ -481,20 +366,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -506,6 +384,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const PetApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = PetApiAxiosParamCreator(configuration) return { /** * @@ -515,11 +394,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async addPet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).addPet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.addPet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -530,11 +406,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deletePet(petId: number, apiKey?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deletePet(petId, apiKey, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple status values can be provided with comma separated strings @@ -544,11 +417,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByStatus(status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -558,11 +428,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByTags(tags: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByTags(tags, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a single pet @@ -572,11 +439,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getPetById(petId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).getPetById(petId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getPetById(petId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -586,11 +450,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -602,11 +463,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePetWithForm(petId, name, status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -618,11 +476,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, additionalMetadata, file, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -632,6 +487,7 @@ export const PetApiFp = function(configuration?: Configuration) { * @export */ export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = PetApiFp(configuration) return { /** * @@ -641,7 +497,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ addPet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).addPet(body, options).then((request) => request(axios, basePath)); + return localVarFp.addPet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -652,7 +508,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ deletePet(petId: number, apiKey?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); + return localVarFp.deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); }, /** * Multiple status values can be provided with comma separated strings @@ -662,7 +518,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByStatus(status, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByStatus(status, options).then((request) => request(axios, basePath)); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -672,7 +528,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByTags(tags: Array, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByTags(tags, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByTags(tags, options).then((request) => request(axios, basePath)); }, /** * Returns a single pet @@ -682,7 +538,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ getPetById(petId: number, options?: any): AxiosPromise { - return PetApiFp(configuration).getPetById(petId, options).then((request) => request(axios, basePath)); + return localVarFp.getPetById(petId, options).then((request) => request(axios, basePath)); }, /** * @@ -692,7 +548,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePet(body, options).then((request) => request(axios, basePath)); + return localVarFp.updatePet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -704,7 +560,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePetWithForm(petId: number, name?: string, status?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); + return localVarFp.updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); }, /** * @@ -716,7 +572,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): AxiosPromise { - return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); + return localVarFp.uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); }, }; }; diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/store-api.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/store-api.ts index ca42fa29018..d9f74b95dbb 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/store-api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/store-api.ts @@ -17,6 +17,8 @@ import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; import { Configuration } from '../../../configuration'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../../../common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base'; // @ts-ignore import { Order } from '../../../model/some/levels/deep'; @@ -35,13 +37,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ deleteOrder: async (orderId: string, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); - } + assertParamExists('deleteOrder', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -53,19 +53,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -78,7 +71,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration getInventory: async (options: any = {}): Promise => { const localVarPath = `/store/inventory`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -89,28 +82,16 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -123,13 +104,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ getOrderById: async (orderId: number, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); - } + assertParamExists('getOrderById', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -141,19 +120,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -166,12 +138,10 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ placeOrder: async (body: Order, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.'); - } + assertParamExists('placeOrder', 'body', body) const localVarPath = `/store/order`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -185,26 +155,13 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -216,6 +173,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration * @export */ export const StoreApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = StoreApiAxiosParamCreator(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -225,11 +183,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteOrder(orderId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteOrder(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a map of status codes to quantities @@ -238,11 +193,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getInventory(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }>> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getInventory(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getInventory(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -252,11 +204,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getOrderById(orderId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderById(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -266,11 +215,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async placeOrder(body: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).placeOrder(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.placeOrder(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -280,6 +226,7 @@ export const StoreApiFp = function(configuration?: Configuration) { * @export */ export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = StoreApiFp(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -289,7 +236,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ deleteOrder(orderId: string, options?: any): AxiosPromise { - return StoreApiFp(configuration).deleteOrder(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.deleteOrder(orderId, options).then((request) => request(axios, basePath)); }, /** * Returns a map of status codes to quantities @@ -298,7 +245,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getInventory(options?: any): AxiosPromise<{ [key: string]: number; }> { - return StoreApiFp(configuration).getInventory(options).then((request) => request(axios, basePath)); + return localVarFp.getInventory(options).then((request) => request(axios, basePath)); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -308,7 +255,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getOrderById(orderId: number, options?: any): AxiosPromise { - return StoreApiFp(configuration).getOrderById(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.getOrderById(orderId, options).then((request) => request(axios, basePath)); }, /** * @@ -318,7 +265,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ placeOrder(body: Order, options?: any): AxiosPromise { - return StoreApiFp(configuration).placeOrder(body, options).then((request) => request(axios, basePath)); + return localVarFp.placeOrder(body, options).then((request) => request(axios, basePath)); }, }; }; diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/user-api.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/user-api.ts index bc264d72753..3e63c7e2f36 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/user-api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/user-api.ts @@ -17,6 +17,8 @@ import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; import { Configuration } from '../../../configuration'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../../../common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base'; // @ts-ignore import { User } from '../../../model/some/levels/deep'; @@ -35,12 +37,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUser: async (body: User, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.'); - } + assertParamExists('createUser', 'body', body) const localVarPath = `/user`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -54,26 +54,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -86,12 +73,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithArrayInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.'); - } + assertParamExists('createUsersWithArrayInput', 'body', body) const localVarPath = `/user/createWithArray`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -105,26 +90,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -137,12 +109,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithListInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.'); - } + assertParamExists('createUsersWithListInput', 'body', body) const localVarPath = `/user/createWithList`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -156,26 +126,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -188,13 +145,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ deleteUser: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); - } + assertParamExists('deleteUser', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -206,19 +161,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -231,13 +179,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ getUserByName: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); - } + assertParamExists('getUserByName', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -249,19 +195,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -275,16 +214,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ loginUser: async (username: string, password: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'username', username) // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'password', password) const localVarPath = `/user/login`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -304,19 +239,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -329,7 +257,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) logoutUser: async (options: any = {}): Promise => { const localVarPath = `/user/logout`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -341,19 +269,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -367,17 +288,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ updateUser: async (username: string, body: User, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'username', username) // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'body', body) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -391,26 +308,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -422,6 +326,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const UserApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = UserApiAxiosParamCreator(configuration) return { /** * This can only be done by the logged in user. @@ -431,11 +336,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUser(body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUser(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUser(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -445,11 +347,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithArrayInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithArrayInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -459,11 +358,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithListInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithListInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -473,11 +369,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteUser(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).deleteUser(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -487,11 +380,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getUserByName(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).getUserByName(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserByName(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -502,11 +392,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async loginUser(username: string, password: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).loginUser(username, password, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.loginUser(username, password, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -515,11 +402,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async logoutUser(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).logoutUser(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.logoutUser(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -530,11 +414,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updateUser(username: string, body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).updateUser(username, body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser(username, body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -544,6 +425,7 @@ export const UserApiFp = function(configuration?: Configuration) { * @export */ export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = UserApiFp(configuration) return { /** * This can only be done by the logged in user. @@ -553,7 +435,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUser(body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).createUser(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUser(body, options).then((request) => request(axios, basePath)); }, /** * @@ -563,7 +445,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithArrayInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); }, /** * @@ -573,7 +455,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithListInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithListInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithListInput(body, options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -583,7 +465,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ deleteUser(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).deleteUser(username, options).then((request) => request(axios, basePath)); + return localVarFp.deleteUser(username, options).then((request) => request(axios, basePath)); }, /** * @@ -593,7 +475,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ getUserByName(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).getUserByName(username, options).then((request) => request(axios, basePath)); + return localVarFp.getUserByName(username, options).then((request) => request(axios, basePath)); }, /** * @@ -604,7 +486,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ loginUser(username: string, password: string, options?: any): AxiosPromise { - return UserApiFp(configuration).loginUser(username, password, options).then((request) => request(axios, basePath)); + return localVarFp.loginUser(username, password, options).then((request) => request(axios, basePath)); }, /** * @@ -613,7 +495,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ logoutUser(options?: any): AxiosPromise { - return UserApiFp(configuration).logoutUser(options).then((request) => request(axios, basePath)); + return localVarFp.logoutUser(options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -624,7 +506,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ updateUser(username: string, body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).updateUser(username, body, options).then((request) => request(axios, basePath)); + return localVarFp.updateUser(username, body, options).then((request) => request(axios, basePath)); }, }; }; diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/common.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/common.ts new file mode 100644 index 00000000000..23e6a699c68 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/FILES index 3a45f5700dd..534fae710fb 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/FILES @@ -3,6 +3,7 @@ README.md api.ts base.ts +common.ts configuration.ts git_push.sh index.ts diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts index 1aca2afe908..856fb0a4829 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts @@ -17,6 +17,8 @@ import { Configuration } from './configuration'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; /** @@ -261,12 +263,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ addPet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.'); - } + assertParamExists('addPet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -278,37 +278,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -322,13 +304,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ deletePet: async (petId: number, apiKey?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); - } + assertParamExists('deletePet', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -340,12 +320,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (apiKey !== undefined && apiKey !== null) { localVarHeaderParameter['api_key'] = String(apiKey); @@ -353,19 +328,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -378,12 +346,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, options: any = {}): Promise => { // verify required parameter 'status' is not null or undefined - if (status === null || status === undefined) { - throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); - } + assertParamExists('findPetsByStatus', 'status', status) const localVarPath = `/pet/findByStatus`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -395,12 +361,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (status) { localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv); @@ -408,19 +369,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -433,12 +387,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByTags: async (tags: Array, options: any = {}): Promise => { // verify required parameter 'tags' is not null or undefined - if (tags === null || tags === undefined) { - throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); - } + assertParamExists('findPetsByTags', 'tags', tags) const localVarPath = `/pet/findByTags`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -450,12 +402,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (tags) { localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv); @@ -463,19 +410,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -488,13 +428,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ getPetById: async (petId: number, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); - } + assertParamExists('getPetById', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -505,28 +443,16 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -539,12 +465,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.'); - } + assertParamExists('updatePet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -556,37 +480,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -601,13 +507,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePetWithForm: async (petId: number, name?: string, status?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); - } + assertParamExists('updatePetWithForm', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -620,12 +524,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (name !== undefined) { @@ -639,20 +538,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams.toString(); return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -667,13 +559,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ uploadFile: async (petId: number, additionalMetadata?: string, file?: any, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); - } + assertParamExists('uploadFile', 'petId', petId) const localVarPath = `/pet/{petId}/uploadImage` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -686,12 +576,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (additionalMetadata !== undefined) { @@ -705,20 +590,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -730,6 +608,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const PetApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = PetApiAxiosParamCreator(configuration) return { /** * @@ -739,11 +618,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async addPet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).addPet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.addPet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -754,11 +630,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deletePet(petId: number, apiKey?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deletePet(petId, apiKey, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple status values can be provided with comma separated strings @@ -768,11 +641,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByStatus(status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -782,11 +652,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByTags(tags: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByTags(tags, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a single pet @@ -796,11 +663,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getPetById(petId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).getPetById(petId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getPetById(petId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -810,11 +674,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -826,11 +687,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePetWithForm(petId, name, status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -842,11 +700,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, additionalMetadata, file, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -856,6 +711,7 @@ export const PetApiFp = function(configuration?: Configuration) { * @export */ export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = PetApiFp(configuration) return { /** * @@ -865,7 +721,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ addPet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).addPet(body, options).then((request) => request(axios, basePath)); + return localVarFp.addPet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -876,7 +732,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ deletePet(petId: number, apiKey?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); + return localVarFp.deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); }, /** * Multiple status values can be provided with comma separated strings @@ -886,7 +742,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByStatus(status, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByStatus(status, options).then((request) => request(axios, basePath)); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -896,7 +752,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByTags(tags: Array, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByTags(tags, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByTags(tags, options).then((request) => request(axios, basePath)); }, /** * Returns a single pet @@ -906,7 +762,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ getPetById(petId: number, options?: any): AxiosPromise { - return PetApiFp(configuration).getPetById(petId, options).then((request) => request(axios, basePath)); + return localVarFp.getPetById(petId, options).then((request) => request(axios, basePath)); }, /** * @@ -916,7 +772,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePet(body, options).then((request) => request(axios, basePath)); + return localVarFp.updatePet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -928,7 +784,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePetWithForm(petId: number, name?: string, status?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); + return localVarFp.updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); }, /** * @@ -940,7 +796,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): AxiosPromise { - return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); + return localVarFp.uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); }, }; }; @@ -1070,13 +926,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ deleteOrder: async (orderId: string, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); - } + assertParamExists('deleteOrder', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1088,19 +942,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1113,7 +960,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration getInventory: async (options: any = {}): Promise => { const localVarPath = `/store/inventory`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1124,28 +971,16 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1158,13 +993,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ getOrderById: async (orderId: number, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); - } + assertParamExists('getOrderById', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1176,19 +1009,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1201,12 +1027,10 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ placeOrder: async (body: Order, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.'); - } + assertParamExists('placeOrder', 'body', body) const localVarPath = `/store/order`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1220,26 +1044,13 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1251,6 +1062,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration * @export */ export const StoreApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = StoreApiAxiosParamCreator(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1260,11 +1072,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteOrder(orderId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteOrder(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a map of status codes to quantities @@ -1273,11 +1082,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getInventory(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }>> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getInventory(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getInventory(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1287,11 +1093,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getOrderById(orderId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderById(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1301,11 +1104,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async placeOrder(body: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).placeOrder(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.placeOrder(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -1315,6 +1115,7 @@ export const StoreApiFp = function(configuration?: Configuration) { * @export */ export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = StoreApiFp(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1324,7 +1125,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ deleteOrder(orderId: string, options?: any): AxiosPromise { - return StoreApiFp(configuration).deleteOrder(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.deleteOrder(orderId, options).then((request) => request(axios, basePath)); }, /** * Returns a map of status codes to quantities @@ -1333,7 +1134,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getInventory(options?: any): AxiosPromise<{ [key: string]: number; }> { - return StoreApiFp(configuration).getInventory(options).then((request) => request(axios, basePath)); + return localVarFp.getInventory(options).then((request) => request(axios, basePath)); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1343,7 +1144,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getOrderById(orderId: number, options?: any): AxiosPromise { - return StoreApiFp(configuration).getOrderById(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.getOrderById(orderId, options).then((request) => request(axios, basePath)); }, /** * @@ -1353,7 +1154,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ placeOrder(body: Order, options?: any): AxiosPromise { - return StoreApiFp(configuration).placeOrder(body, options).then((request) => request(axios, basePath)); + return localVarFp.placeOrder(body, options).then((request) => request(axios, basePath)); }, }; }; @@ -1429,12 +1230,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUser: async (body: User, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.'); - } + assertParamExists('createUser', 'body', body) const localVarPath = `/user`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1448,26 +1247,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1480,12 +1266,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithArrayInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.'); - } + assertParamExists('createUsersWithArrayInput', 'body', body) const localVarPath = `/user/createWithArray`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1499,26 +1283,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1531,12 +1302,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithListInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.'); - } + assertParamExists('createUsersWithListInput', 'body', body) const localVarPath = `/user/createWithList`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1550,26 +1319,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1582,13 +1338,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ deleteUser: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); - } + assertParamExists('deleteUser', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1600,19 +1354,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1625,13 +1372,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ getUserByName: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); - } + assertParamExists('getUserByName', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1643,19 +1388,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1669,16 +1407,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ loginUser: async (username: string, password: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'username', username) // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'password', password) const localVarPath = `/user/login`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1698,19 +1432,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1723,7 +1450,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) logoutUser: async (options: any = {}): Promise => { const localVarPath = `/user/logout`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1735,19 +1462,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1761,17 +1481,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ updateUser: async (username: string, body: User, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'username', username) // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'body', body) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1785,26 +1501,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1816,6 +1519,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const UserApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = UserApiAxiosParamCreator(configuration) return { /** * This can only be done by the logged in user. @@ -1825,11 +1529,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUser(body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUser(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUser(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1839,11 +1540,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithArrayInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithArrayInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1853,11 +1551,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithListInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithListInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -1867,11 +1562,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteUser(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).deleteUser(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1881,11 +1573,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getUserByName(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).getUserByName(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserByName(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1896,11 +1585,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async loginUser(username: string, password: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).loginUser(username, password, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.loginUser(username, password, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1909,11 +1595,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async logoutUser(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).logoutUser(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.logoutUser(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -1924,11 +1607,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updateUser(username: string, body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).updateUser(username, body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser(username, body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -1938,6 +1618,7 @@ export const UserApiFp = function(configuration?: Configuration) { * @export */ export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = UserApiFp(configuration) return { /** * This can only be done by the logged in user. @@ -1947,7 +1628,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUser(body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).createUser(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUser(body, options).then((request) => request(axios, basePath)); }, /** * @@ -1957,7 +1638,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithArrayInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); }, /** * @@ -1967,7 +1648,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithListInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithListInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithListInput(body, options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -1977,7 +1658,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ deleteUser(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).deleteUser(username, options).then((request) => request(axios, basePath)); + return localVarFp.deleteUser(username, options).then((request) => request(axios, basePath)); }, /** * @@ -1987,7 +1668,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ getUserByName(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).getUserByName(username, options).then((request) => request(axios, basePath)); + return localVarFp.getUserByName(username, options).then((request) => request(axios, basePath)); }, /** * @@ -1998,7 +1679,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ loginUser(username: string, password: string, options?: any): AxiosPromise { - return UserApiFp(configuration).loginUser(username, password, options).then((request) => request(axios, basePath)); + return localVarFp.loginUser(username, password, options).then((request) => request(axios, basePath)); }, /** * @@ -2007,7 +1688,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ logoutUser(options?: any): AxiosPromise { - return UserApiFp(configuration).logoutUser(options).then((request) => request(axios, basePath)); + return localVarFp.logoutUser(options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -2018,7 +1699,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ updateUser(username: string, body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).updateUser(username, body, options).then((request) => request(axios, basePath)); + return localVarFp.updateUser(username, body, options).then((request) => request(axios, basePath)); }, }; }; diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/common.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version/common.ts new file mode 100644 index 00000000000..23e6a699c68 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/.openapi-generator/FILES index 5bef353ae38..a80cd4f07b0 100644 --- a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/.openapi-generator/FILES @@ -2,6 +2,7 @@ .npmignore api.ts base.ts +common.ts configuration.ts git_push.sh index.ts diff --git a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts index 601ae3dd581..ec156334713 100644 --- a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts @@ -17,6 +17,8 @@ import { Configuration } from './configuration'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; // Some imports not used depending on template conditions // @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; /** @@ -261,12 +263,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ addPet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.'); - } + assertParamExists('addPet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -278,37 +278,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -322,13 +304,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ deletePet: async (petId: number, apiKey?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); - } + assertParamExists('deletePet', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -340,12 +320,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (apiKey !== undefined && apiKey !== null) { localVarHeaderParameter['api_key'] = String(apiKey); @@ -353,19 +328,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -378,12 +346,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, options: any = {}): Promise => { // verify required parameter 'status' is not null or undefined - if (status === null || status === undefined) { - throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); - } + assertParamExists('findPetsByStatus', 'status', status) const localVarPath = `/pet/findByStatus`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -395,12 +361,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (status) { localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv); @@ -408,19 +369,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -433,12 +387,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ findPetsByTags: async (tags: Array, options: any = {}): Promise => { // verify required parameter 'tags' is not null or undefined - if (tags === null || tags === undefined) { - throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); - } + assertParamExists('findPetsByTags', 'tags', tags) const localVarPath = `/pet/findByTags`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -450,12 +402,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (tags) { localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv); @@ -463,19 +410,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -488,13 +428,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ getPetById: async (petId: number, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); - } + assertParamExists('getPetById', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -505,28 +443,16 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -539,12 +465,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePet: async (body: Pet, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.'); - } + assertParamExists('updatePet', 'body', body) const localVarPath = `/pet`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -556,37 +480,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -601,13 +507,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ updatePetWithForm: async (petId: number, name?: string, status?: string, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); - } + assertParamExists('updatePetWithForm', 'petId', petId) const localVarPath = `/pet/{petId}` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -620,12 +524,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (name !== undefined) { @@ -639,20 +538,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams.toString(); return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -667,13 +559,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) */ uploadFile: async (petId: number, additionalMetadata?: string, file?: any, options: any = {}): Promise => { // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); - } + assertParamExists('uploadFile', 'petId', petId) const localVarPath = `/pet/{petId}/uploadImage` .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -686,12 +576,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // authentication petstore_auth required // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) if (additionalMetadata !== undefined) { @@ -705,20 +590,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -730,6 +608,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const PetApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = PetApiAxiosParamCreator(configuration) return { /** * @@ -739,11 +618,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async addPet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).addPet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.addPet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -754,11 +630,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deletePet(petId: number, apiKey?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deletePet(petId, apiKey, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple status values can be provided with comma separated strings @@ -768,11 +641,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByStatus(status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -782,11 +652,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async findPetsByTags(tags: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByTags(tags, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a single pet @@ -796,11 +663,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getPetById(petId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).getPetById(petId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getPetById(petId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -810,11 +674,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePet(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePet(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -826,11 +687,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePetWithForm(petId, name, status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -842,11 +700,8 @@ export const PetApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, additionalMetadata, file, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -856,6 +711,7 @@ export const PetApiFp = function(configuration?: Configuration) { * @export */ export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = PetApiFp(configuration) return { /** * @@ -865,7 +721,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ addPet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).addPet(body, options).then((request) => request(axios, basePath)); + return localVarFp.addPet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -876,7 +732,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ deletePet(petId: number, apiKey?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); + return localVarFp.deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); }, /** * Multiple status values can be provided with comma separated strings @@ -886,7 +742,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByStatus(status, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByStatus(status, options).then((request) => request(axios, basePath)); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -896,7 +752,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ findPetsByTags(tags: Array, options?: any): AxiosPromise> { - return PetApiFp(configuration).findPetsByTags(tags, options).then((request) => request(axios, basePath)); + return localVarFp.findPetsByTags(tags, options).then((request) => request(axios, basePath)); }, /** * Returns a single pet @@ -906,7 +762,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ getPetById(petId: number, options?: any): AxiosPromise { - return PetApiFp(configuration).getPetById(petId, options).then((request) => request(axios, basePath)); + return localVarFp.getPetById(petId, options).then((request) => request(axios, basePath)); }, /** * @@ -916,7 +772,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePet(body: Pet, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePet(body, options).then((request) => request(axios, basePath)); + return localVarFp.updatePet(body, options).then((request) => request(axios, basePath)); }, /** * @@ -928,7 +784,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ updatePetWithForm(petId: number, name?: string, status?: string, options?: any): AxiosPromise { - return PetApiFp(configuration).updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); + return localVarFp.updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); }, /** * @@ -940,7 +796,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * @throws {RequiredError} */ uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): AxiosPromise { - return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); + return localVarFp.uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); }, }; }; @@ -1212,13 +1068,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ deleteOrder: async (orderId: string, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); - } + assertParamExists('deleteOrder', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1230,19 +1084,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1255,7 +1102,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration getInventory: async (options: any = {}): Promise => { const localVarPath = `/store/inventory`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1266,28 +1113,16 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration const localVarQueryParameter = {} as any; // authentication api_key required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("api_key") - : await configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1300,13 +1135,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration */ getOrderById: async (orderId: number, options: any = {}): Promise => { // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); - } + assertParamExists('getOrderById', 'orderId', orderId) const localVarPath = `/store/order/{orderId}` .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1318,19 +1151,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1344,7 +1170,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration placeOrder: async (body?: Order, options: any = {}): Promise => { const localVarPath = `/store/order`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1358,26 +1184,13 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1389,6 +1202,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration * @export */ export const StoreApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = StoreApiAxiosParamCreator(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1398,11 +1212,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteOrder(orderId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteOrder(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Returns a map of status codes to quantities @@ -1411,11 +1222,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getInventory(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }>> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getInventory(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getInventory(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1425,11 +1233,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getOrderById(orderId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderById(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -1439,11 +1244,8 @@ export const StoreApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async placeOrder(body?: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).placeOrder(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.placeOrder(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -1453,6 +1255,7 @@ export const StoreApiFp = function(configuration?: Configuration) { * @export */ export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = StoreApiFp(configuration) return { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -1462,7 +1265,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ deleteOrder(orderId: string, options?: any): AxiosPromise { - return StoreApiFp(configuration).deleteOrder(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.deleteOrder(orderId, options).then((request) => request(axios, basePath)); }, /** * Returns a map of status codes to quantities @@ -1471,7 +1274,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getInventory(options?: any): AxiosPromise<{ [key: string]: number; }> { - return StoreApiFp(configuration).getInventory(options).then((request) => request(axios, basePath)); + return localVarFp.getInventory(options).then((request) => request(axios, basePath)); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -1481,7 +1284,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ getOrderById(orderId: number, options?: any): AxiosPromise { - return StoreApiFp(configuration).getOrderById(orderId, options).then((request) => request(axios, basePath)); + return localVarFp.getOrderById(orderId, options).then((request) => request(axios, basePath)); }, /** * @@ -1491,7 +1294,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath * @throws {RequiredError} */ placeOrder(body?: Order, options?: any): AxiosPromise { - return StoreApiFp(configuration).placeOrder(body, options).then((request) => request(axios, basePath)); + return localVarFp.placeOrder(body, options).then((request) => request(axios, basePath)); }, }; }; @@ -1609,12 +1412,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUser: async (body: User, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.'); - } + assertParamExists('createUser', 'body', body) const localVarPath = `/user`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1628,26 +1429,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1660,12 +1448,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithArrayInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.'); - } + assertParamExists('createUsersWithArrayInput', 'body', body) const localVarPath = `/user/createWithArray`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1679,26 +1465,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1711,12 +1484,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ createUsersWithListInput: async (body: Array, options: any = {}): Promise => { // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.'); - } + assertParamExists('createUsersWithListInput', 'body', body) const localVarPath = `/user/createWithList`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1730,26 +1501,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1762,13 +1520,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ deleteUser: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); - } + assertParamExists('deleteUser', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1780,19 +1536,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1805,13 +1554,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ getUserByName: async (username: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); - } + assertParamExists('getUserByName', 'username', username) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1823,19 +1570,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1849,16 +1589,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ loginUser: async (username: string, password: string, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'username', username) // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); - } + assertParamExists('loginUser', 'password', password) const localVarPath = `/user/login`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1878,19 +1614,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1903,7 +1632,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) logoutUser: async (options: any = {}): Promise => { const localVarPath = `/user/logout`; // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1915,19 +1644,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1941,17 +1663,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) */ updateUser: async (username: string, body: User, options: any = {}): Promise => { // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'username', username) // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.'); - } + assertParamExists('updateUser', 'body', body) const localVarPath = `/user/{username}` .replace(`{${"username"}}`, encodeURIComponent(String(username))); // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; @@ -1965,26 +1683,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; - const queryParameters = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - queryParameters.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - queryParameters.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const nonString = typeof body !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) - : nonString; - localVarRequestOptions.data = needsSerialization - ? JSON.stringify(body !== undefined ? body : {}) - : (body || ""); + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, @@ -1996,6 +1701,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) * @export */ export const UserApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = UserApiAxiosParamCreator(configuration) return { /** * This can only be done by the logged in user. @@ -2005,11 +1711,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUser(body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUser(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUser(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -2019,11 +1722,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithArrayInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithArrayInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -2033,11 +1733,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async createUsersWithListInput(body: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithListInput(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -2047,11 +1744,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async deleteUser(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).deleteUser(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -2061,11 +1755,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async getUserByName(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).getUserByName(username, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserByName(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -2076,11 +1767,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async loginUser(username: string, password: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).loginUser(username, password, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.loginUser(username, password, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * @@ -2089,11 +1777,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async logoutUser(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).logoutUser(options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.logoutUser(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This can only be done by the logged in user. @@ -2104,11 +1789,8 @@ export const UserApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ async updateUser(username: string, body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).updateUser(username, body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; + const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser(username, body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -2118,6 +1800,7 @@ export const UserApiFp = function(configuration?: Configuration) { * @export */ export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = UserApiFp(configuration) return { /** * This can only be done by the logged in user. @@ -2127,7 +1810,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUser(body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).createUser(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUser(body, options).then((request) => request(axios, basePath)); }, /** * @@ -2137,7 +1820,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithArrayInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithArrayInput(body, options).then((request) => request(axios, basePath)); }, /** * @@ -2147,7 +1830,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ createUsersWithListInput(body: Array, options?: any): AxiosPromise { - return UserApiFp(configuration).createUsersWithListInput(body, options).then((request) => request(axios, basePath)); + return localVarFp.createUsersWithListInput(body, options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -2157,7 +1840,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ deleteUser(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).deleteUser(username, options).then((request) => request(axios, basePath)); + return localVarFp.deleteUser(username, options).then((request) => request(axios, basePath)); }, /** * @@ -2167,7 +1850,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ getUserByName(username: string, options?: any): AxiosPromise { - return UserApiFp(configuration).getUserByName(username, options).then((request) => request(axios, basePath)); + return localVarFp.getUserByName(username, options).then((request) => request(axios, basePath)); }, /** * @@ -2178,7 +1861,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ loginUser(username: string, password: string, options?: any): AxiosPromise { - return UserApiFp(configuration).loginUser(username, password, options).then((request) => request(axios, basePath)); + return localVarFp.loginUser(username, password, options).then((request) => request(axios, basePath)); }, /** * @@ -2187,7 +1870,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ logoutUser(options?: any): AxiosPromise { - return UserApiFp(configuration).logoutUser(options).then((request) => request(axios, basePath)); + return localVarFp.logoutUser(options).then((request) => request(axios, basePath)); }, /** * This can only be done by the logged in user. @@ -2198,7 +1881,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @throws {RequiredError} */ updateUser(username: string, body: User, options?: any): AxiosPromise { - return UserApiFp(configuration).updateUser(username, body, options).then((request) => request(axios, basePath)); + return localVarFp.updateUser(username, body, options).then((request) => request(axios, basePath)); }, }; }; diff --git a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/common.ts b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/common.ts new file mode 100644 index 00000000000..23e6a699c68 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} From f6c617d09f5b3cf9fba5f6814e0936a9784d10db Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 26 Jan 2021 16:34:33 +0800 Subject: [PATCH 45/54] Add typescript-nestjs client generator (#8522) * #3336 add nestjs generator * #3336 add nestjs generator * #3336 add nestjs generator * #3336 add nestjs generator * remove extra files from building * Revert "remove extra files from building" This reverts commit 7f80f961ef0cd0e50b9d2bb856a3703d5b821640. * fix merge * fix tests * Add missing test client options provider for nestjs * cleanup PRS * fix compilation error * remove groovy bin files; * fix tests * add samples * update doc * update samples Co-authored-by: Victor Frank --- .github/.test/samples.json | 24 + .gitignore | 1 + ...typescript-nestjs-v6-provided-in-root.yaml | 9 + docs/generators.md | 1 + docs/generators/typescript-nestjs.md | 254 ++++++++ .../TypeScriptNestjsClientCodegen.java | 552 ++++++++++++++++++ .../org.openapitools.codegen.CodegenConfig | 1 + .../resources/nestjs-client/README.mustache | 0 .../main/resources/nestjs-client/api.mustache | 0 .../resources/nestjs-client/model.mustache | 0 .../typescript-nestjs/README.mustache | 137 +++++ .../typescript-nestjs/api.module.mustache | 32 + .../typescript-nestjs/api.service.mustache | 227 +++++++ .../typescript-nestjs/apiInterface.mustache | 33 ++ .../resources/typescript-nestjs/apis.mustache | 12 + .../typescript-nestjs/configuration.mustache | 79 +++ .../typescript-nestjs/git_push.sh.mustache | 58 ++ .../resources/typescript-nestjs/gitignore | 4 + .../typescript-nestjs/index.mustache | 5 + .../typescript-nestjs/licenseInfo.mustache | 11 + .../typescript-nestjs/model.mustache | 16 + .../typescript-nestjs/modelAlias.mustache | 1 + .../typescript-nestjs/modelEnum.mustache | 20 + .../typescript-nestjs/modelGeneric.mustache | 10 + .../modelGenericAdditionalProperties.mustache | 5 + .../modelGenericEnums.mustache | 30 + .../typescript-nestjs/modelOneOf.mustache | 14 + .../modelTaggedUnion.mustache | 21 + .../typescript-nestjs/models.mustache | 5 + .../typescript-nestjs/nest-cli.mustache | 5 + .../typescript-nestjs/nodemon-debug.mustache | 7 + .../typescript-nestjs/nodemon.mustache | 5 + .../typescript-nestjs/package.mustache | 71 +++ .../typescript-nestjs/tsconfig.build.mustache | 9 + .../typescript-nestjs/tsconfig.mustache | 22 + .../typescript-nestjs/tslint.mustache | 18 + .../typescript-nestjs/variables.mustache | 7 + ...TypeScriptNestjsClientOptionsProvider.java | 92 +++ .../TypeScriptNestjsClientCodegenTest.java | 135 +++++ .../TypeScriptNestjsClientOptionsTest.java | 49 ++ .../TypeScriptNestjsModelTest.java | 236 ++++++++ ...jsAdditionalPropertiesIntegrationTest.java | 48 ++ .../TypescriptNestjsApiVersionTest.java | 52 ++ ...ptNestjsArrayAndObjectIntegrationTest.java | 48 ++ ...ypescriptNestjsPestoreIntegrationTest.java | 48 ++ pom.xml | 2 + .../builds/default/.gitignore | 4 + .../builds/default/.openapi-generator-ignore | 23 + .../builds/default/.openapi-generator/FILES | 22 + .../builds/default/.openapi-generator/VERSION | 1 + .../builds/default/README.md | 137 +++++ .../builds/default/api.module.ts | 28 + .../builds/default/api/api.ts | 7 + .../builds/default/api/pet.service.ts | 478 +++++++++++++++ .../builds/default/api/store.service.ts | 194 ++++++ .../builds/default/api/user.service.ts | 395 +++++++++++++ .../builds/default/configuration.ts | 79 +++ .../builds/default/git_push.sh | 58 ++ .../builds/default/index.ts | 5 + .../builds/default/model/apiResponse.ts | 22 + .../builds/default/model/category.ts | 21 + .../builds/default/model/models.ts | 6 + .../builds/default/model/order.ts | 37 ++ .../builds/default/model/pet.ts | 39 ++ .../builds/default/model/tag.ts | 21 + .../builds/default/model/user.ts | 30 + .../builds/default/package.json | 69 +++ .../builds/default/tsconfig.build.json | 9 + .../builds/default/tsconfig.json | 22 + .../builds/default/tslint.json | 18 + .../builds/default/variables.ts | 7 + 71 files changed, 4148 insertions(+) create mode 100644 bin/configs/typescript-nestjs-v6-provided-in-root.yaml create mode 100644 docs/generators/typescript-nestjs.md create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java create mode 100644 modules/openapi-generator/src/main/resources/nestjs-client/README.mustache create mode 100644 modules/openapi-generator/src/main/resources/nestjs-client/api.mustache create mode 100644 modules/openapi-generator/src/main/resources/nestjs-client/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/README.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/apiInterface.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/apis.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/configuration.mustache create mode 100755 modules/openapi-generator/src/main/resources/typescript-nestjs/git_push.sh.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/gitignore create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/index.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/licenseInfo.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/modelAlias.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/modelEnum.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/modelGeneric.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericAdditionalProperties.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericEnums.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/modelOneOf.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/modelTaggedUnion.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/models.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/nest-cli.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/nodemon-debug.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/nodemon.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/package.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.build.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/tslint.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-nestjs/variables.mustache create mode 100644 modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNestjsClientOptionsProvider.java create mode 100644 modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientCodegenTest.java create mode 100644 modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientOptionsTest.java create mode 100644 modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsModelTest.java create mode 100644 modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsAdditionalPropertiesIntegrationTest.java create mode 100644 modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsApiVersionTest.java create mode 100644 modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsArrayAndObjectIntegrationTest.java create mode 100644 modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsPestoreIntegrationTest.java create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.gitignore create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator-ignore create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/FILES create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/VERSION create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/README.md create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api.module.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/api.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/configuration.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/git_push.sh create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/index.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/apiResponse.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/category.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/models.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/order.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/pet.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/tag.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/user.ts create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/package.json create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.build.json create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.json create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tslint.json create mode 100644 samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/variables.ts diff --git a/.github/.test/samples.json b/.github/.test/samples.json index 1f753ac8fc3..d756cc45dfd 100644 --- a/.github/.test/samples.json +++ b/.github/.test/samples.json @@ -1244,6 +1244,30 @@ "Client: TypeScript" ] }, + { + "input": "typescript-nestjs-v6-petstore-not-provided-in-root-with-npm.sh", + "matches": [ + "Client: TypeScript" + ] + }, + { + "input": "typescript-nestjs-v6-petstore-not-provided-in-root.sh", + "matches": [ + "Client: TypeScript" + ] + }, + { + "input": "typescript-nestjs-v6-petstore-provided-in-root-with-npm.sh", + "matches": [ + "Client: TypeScript" + ] + }, + { + "input": "typescript-nestjs-v6-petstore-provided-in-root.sh", + "matches": [ + "Client: TypeScript" + ] + }, { "input": "typescript-node-petstore-with-npm.sh", "matches": [ diff --git a/.gitignore b/.gitignore index ebe0dc1ff9c..b56824e26e3 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ packages/ .vscode/ **/.vs .factorypath +.metals/* .settings diff --git a/bin/configs/typescript-nestjs-v6-provided-in-root.yaml b/bin/configs/typescript-nestjs-v6-provided-in-root.yaml new file mode 100644 index 00000000000..4fb999ef170 --- /dev/null +++ b/bin/configs/typescript-nestjs-v6-provided-in-root.yaml @@ -0,0 +1,9 @@ +generatorName: typescript-nestjs +outputDir: samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +additionalProperties: + nestVersion: 6.0.0 + "npmName": "@openapitools/typescript-nestjs-petstore" + "npmVersion": "1.0.0" + "npmRepository" : "https://skimdb.npmjs.com/registry" + "snapshot" : false diff --git a/docs/generators.md b/docs/generators.md index 739d0cfd19a..1b2aa656bfb 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -69,6 +69,7 @@ The following generators are available: * [typescript-fetch](generators/typescript-fetch.md) * [typescript-inversify](generators/typescript-inversify.md) * [typescript-jquery](generators/typescript-jquery.md) +* [typescript-nestjs (experimental)](generators/typescript-nestjs.md) * [typescript-node](generators/typescript-node.md) * [typescript-redux-query](generators/typescript-redux-query.md) * [typescript-rxjs](generators/typescript-rxjs.md) diff --git a/docs/generators/typescript-nestjs.md b/docs/generators/typescript-nestjs.md new file mode 100644 index 00000000000..9ec83a6246c --- /dev/null +++ b/docs/generators/typescript-nestjs.md @@ -0,0 +1,254 @@ +--- +title: Config Options for typescript-nestjs +sidebar_label: typescript-nestjs +--- + +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| +|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
    **false**
    The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
    **true**
    Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
    |true| +|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum| +|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| +|fileNaming|Naming convention for the output files: 'camelCase', 'kebab-case'.| |camelCase| +|legacyDiscriminatorBehavior|Set to true for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
    **true**
    The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
    **false**
    The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
    |true| +|modelFileSuffix|The suffix of the file of the generated model (model<suffix>.ts).| |null| +|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original| +|modelSuffix|The suffix of the generated model.| |null| +|nestVersion|The version of Nestjs.| |6.0.0| +|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null| +|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null| +|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0| +|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false| +|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|serviceFileSuffix|The suffix of the file of the generated service (service<suffix>.ts).| |.service| +|serviceSuffix|The suffix of the generated service.| |Service| +|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false| +|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| +|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| +|stringEnums|Generate string enums instead of objects for enum values.| |false| +|supportsES6|Generate code that conforms to ES6.| |false| +|taggedUnions|Use discriminators to create tagged unions instead of extending interfaces.| |false| +|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false| + +## IMPORT MAPPING + +| Type/Alias | Imports | +| ---------- | ------- | + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | +|array|Array| + + +## LANGUAGE PRIMITIVES + +
      +
    • Array
    • +
    • Blob
    • +
    • Boolean
    • +
    • Date
    • +
    • Double
    • +
    • Error
    • +
    • File
    • +
    • Float
    • +
    • Integer
    • +
    • Long
    • +
    • Map
    • +
    • Object
    • +
    • ReadonlyArray
    • +
    • Set
    • +
    • String
    • +
    • any
    • +
    • boolean
    • +
    • number
    • +
    • object
    • +
    • string
    • +
    + +## RESERVED WORDS + +
      +
    • abstract
    • +
    • await
    • +
    • boolean
    • +
    • break
    • +
    • byte
    • +
    • case
    • +
    • catch
    • +
    • char
    • +
    • class
    • +
    • const
    • +
    • continue
    • +
    • debugger
    • +
    • default
    • +
    • delete
    • +
    • do
    • +
    • double
    • +
    • else
    • +
    • enum
    • +
    • export
    • +
    • extends
    • +
    • false
    • +
    • final
    • +
    • finally
    • +
    • float
    • +
    • for
    • +
    • formParams
    • +
    • function
    • +
    • goto
    • +
    • headerParams
    • +
    • if
    • +
    • implements
    • +
    • import
    • +
    • in
    • +
    • instanceof
    • +
    • int
    • +
    • interface
    • +
    • let
    • +
    • long
    • +
    • native
    • +
    • new
    • +
    • null
    • +
    • package
    • +
    • private
    • +
    • protected
    • +
    • public
    • +
    • queryParameters
    • +
    • requestOptions
    • +
    • return
    • +
    • short
    • +
    • static
    • +
    • super
    • +
    • switch
    • +
    • synchronized
    • +
    • this
    • +
    • throw
    • +
    • transient
    • +
    • true
    • +
    • try
    • +
    • typeof
    • +
    • useFormData
    • +
    • var
    • +
    • varLocalDeferred
    • +
    • varLocalPath
    • +
    • void
    • +
    • volatile
    • +
    • while
    • +
    • with
    • +
    • yield
    • +
    + +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✓|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✗|ToolingExtension +|MockServer|✗|ToolingExtension + +### Data Type Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Custom|✗|OAS2,OAS3 +|Int32|✓|OAS2,OAS3 +|Int64|✓|OAS2,OAS3 +|Float|✓|OAS2,OAS3 +|Double|✓|OAS2,OAS3 +|Decimal|✓|ToolingExtension +|String|✓|OAS2,OAS3 +|Byte|✓|OAS2,OAS3 +|Binary|✓|OAS2,OAS3 +|Boolean|✓|OAS2,OAS3 +|Date|✓|OAS2,OAS3 +|DateTime|✓|OAS2,OAS3 +|Password|✓|OAS2,OAS3 +|File|✓|OAS2 +|Array|✓|OAS2,OAS3 +|Maps|✓|ToolingExtension +|CollectionFormat|✓|OAS2 +|CollectionFormatMulti|✓|OAS2 +|Enum|✓|OAS2,OAS3 +|ArrayOfEnum|✓|ToolingExtension +|ArrayOfModel|✓|ToolingExtension +|ArrayOfCollectionOfPrimitives|✓|ToolingExtension +|ArrayOfCollectionOfModel|✓|ToolingExtension +|ArrayOfCollectionOfEnum|✓|ToolingExtension +|MapOfEnum|✓|ToolingExtension +|MapOfModel|✓|ToolingExtension +|MapOfCollectionOfPrimitives|✓|ToolingExtension +|MapOfCollectionOfModel|✓|ToolingExtension +|MapOfCollectionOfEnum|✓|ToolingExtension + +### Documentation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Readme|✓|ToolingExtension +|Model|✓|ToolingExtension +|Api|✓|ToolingExtension + +### Global Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Host|✓|OAS2,OAS3 +|BasePath|✓|OAS2,OAS3 +|Info|✓|OAS2,OAS3 +|Schemes|✗|OAS2,OAS3 +|PartialSchemes|✓|OAS2,OAS3 +|Consumes|✓|OAS2 +|Produces|✓|OAS2 +|ExternalDocumentation|✓|OAS2,OAS3 +|Examples|✓|OAS2,OAS3 +|XMLStructureDefinitions|✗|OAS2,OAS3 +|MultiServer|✗|OAS3 +|ParameterizedServer|✗|OAS3 +|ParameterStyling|✗|OAS3 +|Callbacks|✗|OAS3 +|LinkObjects|✗|OAS3 + +### Parameter Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Path|✓|OAS2,OAS3 +|Query|✓|OAS2,OAS3 +|Header|✓|OAS2,OAS3 +|Body|✓|OAS2 +|FormUnencoded|✓|OAS2 +|FormMultipart|✓|OAS2 +|Cookie|✓|OAS3 + +### Schema Support Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Simple|✓|OAS2,OAS3 +|Composite|✓|OAS2,OAS3 +|Polymorphism|✓|OAS2,OAS3 +|Union|✗|OAS3 + +### Security Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasicAuth|✗|OAS2,OAS3 +|ApiKey|✗|OAS2,OAS3 +|OpenIDConnect|✗|OAS3 +|BearerToken|✗|OAS3 +|OAuth2_Implicit|✗|OAS2,OAS3 +|OAuth2_Password|✗|OAS2,OAS3 +|OAuth2_ClientCredentials|✗|OAS2,OAS3 +|OAuth2_AuthorizationCode|✗|OAS2,OAS3 + +### Wire Format Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|JSON|✓|OAS2,OAS3 +|XML|✓|OAS2,OAS3 +|PROTOBUF|✗|ToolingExtension +|Custom|✗|OAS2,OAS3 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java new file mode 100644 index 00000000000..f8749f72693 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java @@ -0,0 +1,552 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.languages; + +import io.swagger.v3.oas.models.media.Schema; +import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.GeneratorMetadata; +import org.openapitools.codegen.meta.Stability; +import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.utils.ModelUtils; +import org.openapitools.codegen.utils.SemVer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.util.*; + +import static org.apache.commons.lang3.StringUtils.capitalize; +import static org.openapitools.codegen.utils.StringUtils.*; + +public class TypeScriptNestjsClientCodegen extends AbstractTypeScriptClientCodegen { + private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptNestjsClientCodegen.class); + + private static String CLASS_NAME_SUFFIX_PATTERN = "^[a-zA-Z0-9]*$"; + private static String FILE_NAME_SUFFIX_PATTERN = "^[a-zA-Z0-9.-]*$"; + + public static final String NPM_REPOSITORY = "npmRepository"; + public static final String WITH_INTERFACES = "withInterfaces"; + public static final String TAGGED_UNIONS = "taggedUnions"; + public static final String NEST_VERSION = "nestVersion"; + public static final String SERVICE_SUFFIX = "serviceSuffix"; + public static final String SERVICE_FILE_SUFFIX = "serviceFileSuffix"; + public static final String MODEL_SUFFIX = "modelSuffix"; + public static final String MODEL_FILE_SUFFIX = "modelFileSuffix"; + public static final String FILE_NAMING = "fileNaming"; + public static final String STRING_ENUMS = "stringEnums"; + public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values."; + + protected String nestVersion = "6.0.0"; + protected String npmRepository = null; + protected String serviceSuffix = "Service"; + protected String serviceFileSuffix = ".service"; + protected String modelSuffix = ""; + protected String modelFileSuffix = ""; + protected String fileNaming = "camelCase"; + protected Boolean stringEnums = false; + + private boolean taggedUnions = false; + + public TypeScriptNestjsClientCodegen() { + super(); + + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata) + .stability(Stability.EXPERIMENTAL) + .build(); + + this.outputFolder = "generated-code/typescript-nestjs"; + + supportsMultipleInheritance = true; + + embeddedTemplateDir = templateDir = "typescript-nestjs"; + modelTemplateFiles.put("model.mustache", ".ts"); + apiTemplateFiles.put("api.service.mustache", ".ts"); + languageSpecificPrimitives.add("Blob"); + typeMapping.put("file", "Blob"); + apiPackage = "api"; + modelPackage = "model"; + + this.cliOptions.add(new CliOption(NPM_REPOSITORY, + "Use this property to set an url your private npmRepo in the package.json")); + this.cliOptions.add(CliOption.newBoolean(WITH_INTERFACES, + "Setting this property to true will generate interfaces next to the default class implementations.", + false)); + this.cliOptions.add(CliOption.newBoolean(TAGGED_UNIONS, + "Use discriminators to create tagged unions instead of extending interfaces.", + this.taggedUnions)); + this.cliOptions.add(new CliOption(NEST_VERSION, "The version of Nestjs.").defaultValue(this.nestVersion)); + this.cliOptions.add(new CliOption(SERVICE_SUFFIX, "The suffix of the generated service.").defaultValue(this.serviceSuffix)); + this.cliOptions.add(new CliOption(SERVICE_FILE_SUFFIX, "The suffix of the file of the generated service (service.ts).").defaultValue(this.serviceFileSuffix)); + this.cliOptions.add(new CliOption(MODEL_SUFFIX, "The suffix of the generated model.")); + this.cliOptions.add(new CliOption(MODEL_FILE_SUFFIX, "The suffix of the file of the generated model (model.ts).")); + this.cliOptions.add(new CliOption(FILE_NAMING, "Naming convention for the output files: 'camelCase', 'kebab-case'.").defaultValue(this.fileNaming)); + this.cliOptions.add(new CliOption(STRING_ENUMS, STRING_ENUMS_DESC).defaultValue(String.valueOf(this.stringEnums))); + } + + @Override + protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) { + codegenModel.additionalPropertiesType = getTypeDeclaration(getAdditionalProperties(schema)); + addImport(codegenModel, codegenModel.additionalPropertiesType); + } + + @Override + public String getName() { + return "typescript-nestjs"; + } + + @Override + public String getHelp() { + return "Generates a TypeScript Nestjs 6.x client library."; + } + + @Override + public void processOpts() { + super.processOpts(); + supportingFiles.add( + new SupportingFile("models.mustache", modelPackage().replace('.', File.separatorChar), "models.ts")); + supportingFiles + .add(new SupportingFile("apis.mustache", apiPackage().replace('.', File.separatorChar), "api.ts")); + supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts")); + supportingFiles.add(new SupportingFile("api.module.mustache", getIndexDirectory(), "api.module.ts")); + supportingFiles.add(new SupportingFile("configuration.mustache", getIndexDirectory(), "configuration.ts")); + supportingFiles.add(new SupportingFile("variables.mustache", getIndexDirectory(), "variables.ts")); + //supportingFiles.add(new SupportingFile("encoder.mustache", getIndexDirectory(), "encoder.ts")); + supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("README.mustache", getIndexDirectory(), "README.md")); + + // determine Nestjs version + SemVer nestVersion; + if (additionalProperties.containsKey(NEST_VERSION)) { + nestVersion = new SemVer(additionalProperties.get(NEST_VERSION).toString()); + } else { + nestVersion = new SemVer(this.nestVersion); + LOGGER.info("generating code for Nestjs {} ...", nestVersion); + LOGGER.info(" (you can select the nestjs version by setting the additionalProperty nestVersion)"); + } + + if (additionalProperties.containsKey(NPM_NAME)) { + addNpmPackageGeneration(nestVersion); + } + + if (additionalProperties.containsKey(STRING_ENUMS)) { + setStringEnums(Boolean.valueOf(additionalProperties.get(STRING_ENUMS).toString())); + additionalProperties.put("stringEnums", getStringEnums()); + if (getStringEnums()) { + enumSuffix = ""; + classEnumSeparator = ""; + } + } + + if (additionalProperties.containsKey(WITH_INTERFACES)) { + boolean withInterfaces = Boolean.parseBoolean(additionalProperties.get(WITH_INTERFACES).toString()); + if (withInterfaces) { + apiTemplateFiles.put("apiInterface.mustache", "Interface.ts"); + } + } + + if (additionalProperties.containsKey(TAGGED_UNIONS)) { + taggedUnions = Boolean.parseBoolean(additionalProperties.get(TAGGED_UNIONS).toString()); + } + + additionalProperties.put(NEST_VERSION, nestVersion); + additionalProperties.put("injectionToken", nestVersion.atLeast("4.0.0") ? "InjectionToken" : "OpaqueToken"); + additionalProperties.put("injectionTokenTyped", nestVersion.atLeast("4.0.0")); + additionalProperties.put("useHttpClient", nestVersion.atLeast("4.3.0")); + if (additionalProperties.containsKey(SERVICE_SUFFIX)) { + serviceSuffix = additionalProperties.get(SERVICE_SUFFIX).toString(); + validateClassSuffixArgument("Service", serviceSuffix); + } + if (additionalProperties.containsKey(SERVICE_FILE_SUFFIX)) { + serviceFileSuffix = additionalProperties.get(SERVICE_FILE_SUFFIX).toString(); + validateFileSuffixArgument("Service", serviceFileSuffix); + } + if (additionalProperties.containsKey(MODEL_SUFFIX)) { + modelSuffix = additionalProperties.get(MODEL_SUFFIX).toString(); + validateClassSuffixArgument("Model", modelSuffix); + } + if (additionalProperties.containsKey(MODEL_FILE_SUFFIX)) { + modelFileSuffix = additionalProperties.get(MODEL_FILE_SUFFIX).toString(); + validateFileSuffixArgument("Model", modelFileSuffix); + } + if (additionalProperties.containsKey(FILE_NAMING)) { + this.setFileNaming(additionalProperties.get(FILE_NAMING).toString()); + } + } + + private void addNpmPackageGeneration(SemVer nestVersion) { + + if (additionalProperties.containsKey(NPM_REPOSITORY)) { + this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString()); + } + + additionalProperties.put("tsVersion", ">=3.6.0. <4.0.0"); + //Files for building our lib + supportingFiles.add(new SupportingFile("package.mustache", getIndexDirectory(), "package.json")); + supportingFiles.add(new SupportingFile("tsconfig.build.mustache", getIndexDirectory(), "tsconfig.build.json")); + supportingFiles.add(new SupportingFile("tsconfig.mustache", getIndexDirectory(), "tsconfig.json")); + supportingFiles.add(new SupportingFile("tslint.mustache", getIndexDirectory(), "tslint.json")); + } + + private String getIndexDirectory() { + String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.'))); + return indexPackage.replace('.', File.separatorChar); + } + + public void setStringEnums(boolean value) { + stringEnums = value; + } + + public Boolean getStringEnums() { + return stringEnums; + } + + @Override + public boolean isDataTypeFile(final String dataType) { + return dataType != null && dataType.equals("Blob"); + } + + @Override + public String getTypeDeclaration(Schema p) { + if (ModelUtils.isFileSchema(p)) { + return "Blob"; + } else { + return super.getTypeDeclaration(p); + } + } + + @Override + public String getSchemaType(Schema p) { + String openAPIType = super.getSchemaType(p); + if (isLanguagePrimitive(openAPIType) || isLanguageGenericType(openAPIType)) { + return openAPIType; + } + applyLocalTypeMapping(openAPIType); + return openAPIType; + } + + private String applyLocalTypeMapping(String type) { + if (typeMapping.containsKey(type)) { + type = typeMapping.get(type); + } + return type; + } + + private boolean isLanguagePrimitive(String type) { + return languageSpecificPrimitives.contains(type); + } + + private boolean isLanguageGenericType(String type) { + for (String genericType : languageGenericTypes) { + if (type.startsWith(genericType + "<")) { + return true; + } + } + return false; + } + + @Override + public void postProcessParameter(CodegenParameter parameter) { + super.postProcessParameter(parameter); + parameter.dataType = applyLocalTypeMapping(parameter.dataType); + } + + @Override + public Map postProcessOperationsWithModels(Map operations, List allModels) { + Map objs = (Map) operations.get("operations"); + + // Add filename information for api imports + objs.put("apiFilename", getApiFilenameFromClassname(objs.get("classname").toString())); + + List ops = (List) objs.get("operation"); + boolean hasSomeFormParams = false; + for (CodegenOperation op : ops) { + if (op.getHasFormParams()) { + hasSomeFormParams = true; + } + op.httpMethod = op.httpMethod.toLowerCase(Locale.ENGLISH); + + // Prep a string buffer where we're going to set up our new version of the string. + StringBuilder pathBuffer = new StringBuilder(); + StringBuilder parameterName = new StringBuilder(); + int insideCurly = 0; + + // Iterate through existing string, one character at a time. + for (int i = 0; i < op.path.length(); i++) { + switch (op.path.charAt(i)) { + case '{': + // We entered curly braces, so track that. + insideCurly++; + + // Add the more complicated component instead of just the brace. + pathBuffer.append("${encodeURIComponent(String("); + break; + case '}': + // We exited curly braces, so track that. + insideCurly--; + + // Add the more complicated component instead of just the brace. + CodegenParameter parameter = findPathParameterByName(op, parameterName.toString()); + pathBuffer.append(toVarName(parameterName.toString())); + if (parameter != null && parameter.isDateTime) { + pathBuffer.append(".toISOString()"); + } + pathBuffer.append("))}"); + parameterName.setLength(0); + break; + default: + char nextChar = op.path.charAt(i); + if (insideCurly > 0) { + parameterName.append(nextChar); + } else { + pathBuffer.append(nextChar); + } + break; + } + } + + // Overwrite path to TypeScript template string, after applying everything we just did. + op.path = pathBuffer.toString(); + } + + operations.put("hasSomeFormParams", hasSomeFormParams); + + // Add additional filename information for model imports in the services + List> imports = (List>) operations.get("imports"); + for (Map im : imports) { + im.put("filename", im.get("import")); + im.put("classname", im.get("classname")); + } + + return operations; + } + + /** + * Finds and returns a path parameter of an operation by its name + * + * @param operation the operation + * @param parameterName the name of the parameter + * @return param + */ + private CodegenParameter findPathParameterByName(CodegenOperation operation, String parameterName) { + for (CodegenParameter param : operation.pathParams) { + if (param.baseName.equals(parameterName)) { + return param; + } + } + return null; + } + + @Override + public Map postProcessModels(Map objs) { + Map result = super.postProcessModels(objs); + return postProcessModelsEnum(result); + } + + @Override + public Map postProcessAllModels(Map objs) { + Map result = super.postProcessAllModels(objs); + for (Map.Entry entry : result.entrySet()) { + Map inner = (Map) entry.getValue(); + List> models = (List>) inner.get("models"); + for (Map mo : models) { + CodegenModel cm = (CodegenModel) mo.get("model"); + if (taggedUnions) { + mo.put(TAGGED_UNIONS, true); + if (cm.discriminator != null && cm.children != null) { + for (CodegenModel child : cm.children) { + cm.imports.add(child.classname); + } + } + if (cm.parent != null) { + cm.imports.remove(cm.parent); + } + } + // Add additional filename information for imports + Set parsedImports = parseImports(cm); + mo.put("tsImports", toTsImports(cm, parsedImports)); + } + } + return result; + } + + /** + * Parse imports + */ + private Set parseImports(CodegenModel cm) { + Set newImports = new HashSet(); + if (cm.imports.size() > 0) { + for (String name : cm.imports) { + if (name.indexOf(" | ") >= 0) { + String[] parts = name.split(" \\| "); + for (String s : parts) { + newImports.add(s); + } + } else { + newImports.add(name); + } + } + } + return newImports; + } + + private List> toTsImports(CodegenModel cm, Set imports) { + List> tsImports = new ArrayList<>(); + for (String im : imports) { + if (!im.equals(cm.classname)) { + HashMap tsImport = new HashMap<>(); + // TVG: This is used as class name in the import statements of the model file + tsImport.put("classname", im); + tsImport.put("filename", toModelFilename(removeModelPrefixSuffix(im))); + tsImports.add(tsImport); + } + } + return tsImports; + } + + @Override + public String toApiName(String name) { + if (name.length() == 0) { + return "DefaultService"; + } + return camelize(name) + serviceSuffix; + } + + @Override + public String toApiFilename(String name) { + if (name.length() == 0) { + return "default.service"; + } + return this.convertUsingFileNamingConvention(name) + serviceFileSuffix; + } + + @Override + public String toApiImport(String name) { + return apiPackage() + "/" + toApiFilename(name); + } + + @Override + public String toModelFilename(String name) { + return this.convertUsingFileNamingConvention(this.sanitizeName(name)) + modelFileSuffix; + } + + @Override + public String toModelImport(String name) { + return modelPackage() + "/" + toModelFilename(name); + } + + public String getNpmRepository() { + return npmRepository; + } + + public void setNpmRepository(String npmRepository) { + this.npmRepository = npmRepository; + } + + private String getApiFilenameFromClassname(String classname) { + String name = classname.substring(0, classname.length() - serviceSuffix.length()); + return toApiFilename(name); + } + + @Override + public String toModelName(String name) { + String modelName = super.toModelName(name); + if (modelSuffix.length() == 0 || modelName.endsWith(modelSuffix)) { + return modelName; + } + return modelName + modelSuffix; + } + + public String removeModelPrefixSuffix(String name) { + String result = name; + if (modelSuffix.length() > 0 && result.endsWith(modelSuffix)) { + result = result.substring(0, result.length() - modelSuffix.length()); + } + String prefix = capitalize(this.modelNamePrefix); + String suffix = capitalize(this.modelNameSuffix); + if (prefix.length() > 0 && result.startsWith(prefix)) { + result = result.substring(prefix.length()); + } + if (suffix.length() > 0 && result.endsWith(suffix)) { + result = result.substring(0, result.length() - suffix.length()); + } + + return result; + } + + /** + * Validates that the given string value only contains '-', '.' and alpha numeric characters. + * Throws an IllegalArgumentException, if the string contains any other characters. + * + * @param argument The name of the argument being validated. This is only used for displaying an error message. + * @param value The value that is being validated. + */ + private void validateFileSuffixArgument(String argument, String value) { + if (!value.matches(FILE_NAME_SUFFIX_PATTERN)) { + throw new IllegalArgumentException( + String.format(Locale.ROOT, "%s file suffix only allows '.', '-' and alphanumeric characters.", argument) + ); + } + } + + /** + * Validates that the given string value only contains alpha numeric characters. + * Throws an IllegalArgumentException, if the string contains any other characters. + * + * @param argument The name of the argument being validated. This is only used for displaying an error message. + * @param value The value that is being validated. + */ + private void validateClassSuffixArgument(String argument, String value) { + if (!value.matches(CLASS_NAME_SUFFIX_PATTERN)) { + throw new IllegalArgumentException( + String.format(Locale.ROOT, "%s class suffix only allows alphanumeric characters.", argument) + ); + } + } + + /** + * Set the file naming type. + * + * @param fileNaming the file naming to use + */ + private void setFileNaming(String fileNaming) { + if ("camelCase".equals(fileNaming) || "kebab-case".equals(fileNaming)) { + this.fileNaming = fileNaming; + } else { + throw new IllegalArgumentException("Invalid file naming '" + + fileNaming + "'. Must be 'camelCase' or 'kebab-case'"); + } + } + + /** + * Converts the original name according to the current fileNaming strategy. + * + * @param originalName the original name to transform + * @return the transformed name + */ + private String convertUsingFileNamingConvention(String originalName) { + String name = this.removeModelPrefixSuffix(originalName); + if ("kebab-case".equals(fileNaming)) { + name = dashize(underscore(name)); + } else { + name = camelize(name, true); + } + return name; + } + +} + diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig index 7a0d6556be6..18bfd3dc556 100644 --- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig +++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig @@ -126,6 +126,7 @@ org.openapitools.codegen.languages.TypeScriptAxiosClientCodegen org.openapitools.codegen.languages.TypeScriptFetchClientCodegen org.openapitools.codegen.languages.TypeScriptInversifyClientCodegen org.openapitools.codegen.languages.TypeScriptJqueryClientCodegen +org.openapitools.codegen.languages.TypeScriptNestjsClientCodegen org.openapitools.codegen.languages.TypeScriptNodeClientCodegen org.openapitools.codegen.languages.TypeScriptReduxQueryClientCodegen org.openapitools.codegen.languages.TypeScriptRxjsClientCodegen diff --git a/modules/openapi-generator/src/main/resources/nestjs-client/README.mustache b/modules/openapi-generator/src/main/resources/nestjs-client/README.mustache new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/openapi-generator/src/main/resources/nestjs-client/api.mustache b/modules/openapi-generator/src/main/resources/nestjs-client/api.mustache new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/openapi-generator/src/main/resources/nestjs-client/model.mustache b/modules/openapi-generator/src/main/resources/nestjs-client/model.mustache new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/README.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/README.mustache new file mode 100644 index 00000000000..c5ae5f3530c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/README.mustache @@ -0,0 +1,137 @@ +## {{npmName}}@{{npmVersion}} + +### Building + +To install the required dependencies and to build the typescript sources run: +``` +npm install +npm run build +``` + +#### General usage + +In your Nestjs project: + + +``` +// without configuring providers +import { ApiModule } from '{{npmName}}'; +import { HttpModule } from '@nestjs/common'; + +@Module({ + imports: [ + ApiModule, + HttpModule + ], + providers: [] +}) +export class AppModule {} +``` + +``` +// configuring providers +import { ApiModule, Configuration, ConfigurationParameters } from '{{npmName}}'; + +export function apiConfigFactory (): Configuration => { + const params: ConfigurationParameters = { + // set configuration parameters here. + } + return new Configuration(params); +} + +@Module({ + imports: [ ApiModule.forRoot(apiConfigFactory) ], + declarations: [ AppComponent ], + providers: [], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + +``` +import { DefaultApi } from '{{npmName}}'; + +export class AppComponent { + constructor(private apiGateway: DefaultApi) { } +} +``` + +Note: The ApiModule a dynamic module and instantiated once app wide. +This is to ensure that all services are treated as singletons. + +#### Using multiple swagger files / APIs / ApiModules +In order to use multiple `ApiModules` generated from different swagger files, +you can create an alias name when importing the modules +in order to avoid naming conflicts: +``` +import { ApiModule } from 'my-api-path'; +import { ApiModule as OtherApiModule } from 'my-other-api-path'; +import { HttpModule } from '@nestjs/common'; + +@Module({ + imports: [ + ApiModule, + OtherApiModule, + HttpModule + ] +}) +export class AppModule { + +} +``` + + +### Set service base path +If different than the generated base path, during app bootstrap, you can provide the base path to your service. + +``` +import { BASE_PATH } from '{{npmName}}'; + +bootstrap(AppComponent, [ + { provide: BASE_PATH, useValue: 'https://your-web-service.com' }, +]); +``` +or + +``` +import { BASE_PATH } from '{{npmName}}'; + +@Module({ + imports: [], + declarations: [ AppComponent ], + providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + + +#### Using @nestjs/cli +First extend your `src/environments/*.ts` files by adding the corresponding base path: + +``` +export const environment = { + production: false, + API_BASE_PATH: 'http://127.0.0.1:8080' +}; +``` + +In the src/app/app.module.ts: +``` +import { BASE_PATH } from '{{npmName}}'; +import { environment } from '../environments/environment'; + +@Module({ + declarations: [ + AppComponent + ], + imports: [ ], + providers: [ + { + provide: 'BASE_PATH', + useValue: environment.API_BASE_PATH + } + ] +}) +export class AppModule { } +``` \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache new file mode 100644 index 00000000000..0226f69fb1f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache @@ -0,0 +1,32 @@ +import { DynamicModule, HttpService, HttpModule, Module, Global } from '@nestjs/common'; +import { Configuration } from './configuration'; +import { BASE_PATH } from './variables'; + +{{#apiInfo}} +{{#apis}} +import { {{classname}} } from './{{importPath}}'; +{{/apis}} +{{/apiInfo}} + +@Global +@Module({ + imports: [ HttpModule ], + exports: [ + {{#apiInfo}}{{#apis}}{{classname}}{{#hasMore}}, + {{/hasMore}}{{/apis}}{{/apiInfo}} + ], + providers: [ + {{#apiInfo}}{{#apis}}{{classname}}{{#hasMore}}, + {{/hasMore}}{{/apis}}{{/apiInfo}} + ] +}) +export class ApiModule { + public static forRoot(configurationFactory: () => Configuration): DynamicModule { + return { + module: ApiModule, + providers: [ { provide: Configuration, useFactory: configurationFactory } ] + }; + } + + constructor( httpService: HttpService) { } +} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache new file mode 100644 index 00000000000..3bc043bddb1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache @@ -0,0 +1,227 @@ +{{>licenseInfo}} +/* tslint:disable:no-unused-variable member-ordering */ + +import { HttpService, Inject, Injectable } from '@nestjs/common'; +import { AxiosResponse } from 'axios'; +import { Observable } from 'rxjs'; +{{#imports}} +import { {{classname}} } from '../{{filename}}'; +{{/imports}} +import { Configuration } from '../configuration'; +import { COLLECTION_FORMATS } from '../variables'; +{{#withInterfaces}} +import { {{classname}}Interface } from './{{classFilename}}Interface'; +{{/withInterfaces}} + +{{#operations}} + +{{#description}} +/** + * {{&description}} + */ +{{/description}} +@Injectable() +{{#withInterfaces}} +export class {{classname}} implements {{classname}}Interface { +{{/withInterfaces}} +{{^withInterfaces}} +export class {{classname}} { +{{/withInterfaces}} + + protected basePath = '{{{basePath}}}'; + public defaultHeaders = new Map() + public configuration = new Configuration(); + + constructor(protected httpClient: HttpService, configuration: Configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + return consumes.includes(form); + } + +{{#operation}} + /** + * {{summary}} + * {{notes}} + {{#allParams}}* @param {{paramName}} {{description}} + {{/allParams}}* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}): Observable>; + public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}): Observable { +{{#allParams}} + +{{#required}} + {{#isConstEnumParam}} + let {{paramName}} = {{{dataType}}}; + {{/isConstEnumParam}} + {{^isConstEnumParam}} + if ({{paramName}} === null || {{paramName}} === undefined) { + throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); + } + {{/isConstEnumParam}} +{{/required}} +{{/allParams}} + +{{#hasQueryParams}} + let queryParameters = {}; +{{#queryParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + {{paramName}}.forEach((element) => { + queryParameters.append('{{baseName}}', element); + }) + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + queryParameters['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']); + {{/isCollectionFormatMulti}} + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined && {{paramName}} !== null) { + {{#isDateTime}} + queryParameters['{{baseName}}'] = {{paramName}}.toISOString(); + {{/isDateTime}} + {{^isDateTime}} + queryParameters['{{baseName}}'] {{paramName}}; + {{/isDateTime}} + } + {{/isListContainer}} +{{/queryParams}} + +{{/hasQueryParams}} + let headers = this.defaultHeaders; +{{#headerParams}} + {{#isListContainer}} + if ({{paramName}}) { + headers['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']); + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined && {{paramName}} !== null) { + headers['{{baseName}}'] String({{paramName}}); + } + {{/isListContainer}} +{{/headerParams}} + +{{#authMethods}} + // authentication ({{name}}) required +{{#isApiKey}} +{{#isKeyInHeader}} + if (this.configuration.apiKeys["{{keyParamName}}"]) { + headers['{{keyParamName}}'] = this.configuration.apiKeys["{{keyParamName}}"]; + } + +{{/isKeyInHeader}} +{{#isKeyInQuery}} + if (this.configuration.apiKeys["{{keyParamName}}"]) { + queryParameters['{{keyParamName}}'] = this.configuration.apiKeys["{{keyParamName}}"]; + } + +{{/isKeyInQuery}} +{{/isApiKey}} +{{#isBasic}} + if (this.configuration.username || this.configuration.password) { + headers['Authorization'] = 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password); + } + +{{/isBasic}} +{{#isOAuth}} + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + +{{/isOAuth}} +{{/authMethods}} + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + {{#produces}} + '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} + {{/produces}} + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + {{#consumes}} + '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} + {{/consumes}} + ]; +{{#bodyParam}} + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } +{{/bodyParam}} + +{{#hasFormParams}} + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void; }; + let useForm = false; + let convertFormParamsToString = false; +{{#formParams}} +{{#isFile}} + // use FormData to transmit files using content-type "multipart/form-data" + // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data + useForm = canConsumeForm; +{{/isFile}} +{{/formParams}} + if (useForm) { + formParams = new FormData(); + } else { + // formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + } + +{{#formParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + {{paramName}}.forEach((element) => { + formParams.append('{{baseName}}', element); + }) + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + formParams.append('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}'])); + {{/isCollectionFormatMulti}} + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined) { + formParams.append('{{baseName}}', {{paramName}}); + } + {{/isListContainer}} +{{/formParams}} + +{{/hasFormParams}} + return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}} + {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams.toString() : formParams{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}} + { +{{#hasQueryParams}} + params: queryParameters, +{{/hasQueryParams}} +{{#isResponseFile}} + responseType: "blob", +{{/isResponseFile}} + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } +{{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/apiInterface.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/apiInterface.mustache new file mode 100644 index 00000000000..5d0ae503915 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/apiInterface.mustache @@ -0,0 +1,33 @@ +{{>licenseInfo}} + +import { Observable } from 'rxjs'; + +{{#imports}} +import { {{classname}} } from '../{{filename}}'; +{{/imports}} + + +import { Configuration } from '../configuration'; + +{{#operations}} + +{{#description}} + /** + * {{&description}} + */ +{{/description}} +export interface {{classname}}Interface { + defaultHeaders: {}; + configuration: Configuration; + +{{#operation}} + /** + * {{summary}} + * {{notes}} + {{#allParams}}* @param {{paramName}} {{description}} + {{/allParams}}*/ + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any): Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}>; + +{{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/apis.mustache new file mode 100644 index 00000000000..514b5e0d10f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/apis.mustache @@ -0,0 +1,12 @@ +{{#apiInfo}} +{{#apis}} +{{#operations}} +export * from './{{ classFilename }}'; +import { {{ classname }} } from './{{ classFilename }}'; +{{/operations}} +{{#withInterfaces}} +export * from './{{ classFilename }}Interface' +{{/withInterfaces}} +{{/apis}} +export const APIS = [{{#apis}}{{#operations}}{{ classname }}{{/operations}}{{^-last}}, {{/-last}}{{/apis}}]; +{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/configuration.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/configuration.mustache new file mode 100644 index 00000000000..82e8458f39e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/configuration.mustache @@ -0,0 +1,79 @@ +export interface ConfigurationParameters { + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; +} + +export class Configuration { + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; + + constructor(configurationParameters: ConfigurationParameters = {}) { + this.apiKeys = configurationParameters.apiKeys; + this.username = configurationParameters.username; + this.password = configurationParameters.password; + this.accessToken = configurationParameters.accessToken; + this.basePath = configurationParameters.basePath; + this.withCredentials = configurationParameters.withCredentials; + } + + /** + * Select the correct content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param contentTypes - the array of content types that are available for selection + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderContentType (contentTypes: string[]): string | undefined { + if (contentTypes.length == 0) { + return undefined; + } + + let type = contentTypes.find(x => this.isJsonMime(x)); + if (type === undefined) { + return contentTypes[0]; + } + return type; + } + + /** + * Select the correct accept content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param accepts - the array of content types that are available for selection. + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderAccept(accepts: string[]): string | undefined { + if (accepts.length == 0) { + return undefined; + } + + let type = accepts.find(x => this.isJsonMime(x)); + if (type === undefined) { + return accepts[0]; + } + return type; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/git_push.sh.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/git_push.sh.mustache new file mode 100755 index 00000000000..8b3f689c912 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/git_push.sh.mustache @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="{{{gitHost}}}" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/gitignore b/modules/openapi-generator/src/main/resources/typescript-nestjs/gitignore new file mode 100644 index 00000000000..149b5765472 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/index.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/index.mustache new file mode 100644 index 00000000000..c312b70fa3e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/index.mustache @@ -0,0 +1,5 @@ +export * from './api/api'; +export * from './model/models'; +export * from './variables'; +export * from './configuration'; +export * from './api.module'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/licenseInfo.mustache new file mode 100644 index 00000000000..835764cfc72 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/licenseInfo.mustache @@ -0,0 +1,11 @@ +/** + * {{{appName}}} + * {{{appDescription}}} + * + * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} + * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/model.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/model.mustache new file mode 100644 index 00000000000..0afee532731 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/model.mustache @@ -0,0 +1,16 @@ +{{>licenseInfo}} +{{#models}} +{{#model}} +{{#tsImports}} +import { {{classname}} } from './{{filename}}'; +{{/tsImports}} + + +{{#description}} +/** + * {{{description}}} + */ +{{/description}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#isAlias}}{{>modelAlias}}{{/isAlias}}{{^isAlias}}{{#taggedUnions}}{{>modelTaggedUnion}}{{/taggedUnions}}{{^taggedUnions}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{^oneOf}}{{>modelGeneric}}{{/oneOf}}{{/taggedUnions}}{{/isAlias}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelAlias.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelAlias.mustache new file mode 100644 index 00000000000..c1c6bf7a5da --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelAlias.mustache @@ -0,0 +1 @@ +export type {{classname}} = {{dataType}}; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelEnum.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelEnum.mustache new file mode 100644 index 00000000000..4695a611e79 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelEnum.mustache @@ -0,0 +1,20 @@ +{{#stringEnums}} +export enum {{classname}} { +{{#allowableValues}} +{{#enumVars}} + {{name}} = {{{value}}}{{^-last}},{{/-last}} +{{/enumVars}} +{{/allowableValues}} +}; +{{/stringEnums}} +{{^stringEnums}} +export type {{classname}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}} | {{/-last}}{{/enumVars}}{{/allowableValues}}; + +export const {{classname}} = { +{{#allowableValues}} +{{#enumVars}} + {{name}}: {{{value}}} as {{classname}}{{^-last}},{{/-last}} +{{/enumVars}} +{{/allowableValues}} +}; +{{/stringEnums}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGeneric.mustache new file mode 100644 index 00000000000..93d0fb629db --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGeneric.mustache @@ -0,0 +1,10 @@ +export interface {{classname}}{{#allParents}}{{#-first}} extends {{/-first}}{{{.}}}{{^-last}}, {{/-last}}{{/allParents}} { {{>modelGenericAdditionalProperties}} +{{#vars}} + {{#description}} + /** + * {{{description}}} + */ + {{/description}} + {{#isReadOnly}}readonly {{/isReadOnly}}{{{name}}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}}; +{{/vars}} +}{{>modelGenericEnums}} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericAdditionalProperties.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericAdditionalProperties.mustache new file mode 100644 index 00000000000..e6499ce9d63 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericAdditionalProperties.mustache @@ -0,0 +1,5 @@ +{{#additionalPropertiesType}} + + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + +{{/additionalPropertiesType}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericEnums.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericEnums.mustache new file mode 100644 index 00000000000..a824e55ec53 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGenericEnums.mustache @@ -0,0 +1,30 @@ +{{#hasEnums}} + +{{^stringEnums}} +export namespace {{classname}} { +{{/stringEnums}} +{{#vars}} + {{#isEnum}} +{{#stringEnums}} +export enum {{classname}}{{enumName}} { +{{#allowableValues}} +{{#enumVars}} + {{name}} = {{{value}}}{{^-last}},{{/-last}} +{{/enumVars}} +{{/allowableValues}} +}; +{{/stringEnums}} +{{^stringEnums}} + export type {{enumName}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}} | {{/-last}}{{/enumVars}}{{/allowableValues}}; + export const {{enumName}} = { + {{#allowableValues}} + {{#enumVars}} + {{name}}: {{{value}}} as {{enumName}}{{^-last}},{{/-last}} + {{/enumVars}} + {{/allowableValues}} + }; +{{/stringEnums}} + {{/isEnum}} +{{/vars}} +{{^stringEnums}}}{{/stringEnums}} +{{/hasEnums}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelOneOf.mustache new file mode 100644 index 00000000000..0763eaacf1e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelOneOf.mustache @@ -0,0 +1,14 @@ +{{#hasImports}} +import { + {{#imports}} + {{{.}}}, + {{/imports}} +} from './'; + +{{/hasImports}} +/** + * @type {{classname}}{{#description}} + * {{{description}}}{{/description}} + * @export + */ +export type {{classname}} = {{#oneOf}}{{{.}}}{{^-last}} | {{/-last}}{{/oneOf}}; diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelTaggedUnion.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelTaggedUnion.mustache new file mode 100644 index 00000000000..0189ea8b0ec --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelTaggedUnion.mustache @@ -0,0 +1,21 @@ +{{#discriminator}} +export type {{classname}} = {{#children}}{{^-first}} | {{/-first}}{{classname}}{{/children}}; +{{/discriminator}} +{{^discriminator}} +{{#parent}} +export interface {{classname}} { {{>modelGenericAdditionalProperties}} +{{#allVars}} + {{#description}} + /** + * {{{description}}} + */ + {{/description}} + {{name}}{{^required}}?{{/required}}: {{#discriminatorValue}}'{{discriminatorValue}}'{{/discriminatorValue}}{{^discriminatorValue}}{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{/discriminatorValue}}{{#isNullable}} | null{{/isNullable}}; +{{/allVars}} +} +{{>modelGenericEnums}} +{{/parent}} +{{^parent}} +{{>modelGeneric}} +{{/parent}} +{{/discriminator}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/models.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/models.mustache new file mode 100644 index 00000000000..02a39c248c4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/models.mustache @@ -0,0 +1,5 @@ +{{#models}} +{{#model}} +export * from './{{{ classFilename }}}'; +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/nest-cli.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/nest-cli.mustache new file mode 100644 index 00000000000..0dde5f8c4d8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/nest-cli.mustache @@ -0,0 +1,5 @@ +{ + "language": "ts", + "collection": "@nestjs/schematics", + "sourceRoot": "src" +} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/nodemon-debug.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/nodemon-debug.mustache new file mode 100644 index 00000000000..f34d1d7b90a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/nodemon-debug.mustache @@ -0,0 +1,7 @@ +{ + "watch": ["src"], + "ext": "ts", + "ignore": ["src/**/*.spec.ts"], + "exec": "node --inspect-brk -r ts-node/register -r tsconfig-paths/register src/main.ts" + } + \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/nodemon.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/nodemon.mustache new file mode 100644 index 00000000000..512e59aba97 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/nodemon.mustache @@ -0,0 +1,5 @@ +{ + "watch": ["dist"], + "ext": "js", + "exec": "node dist/main" +} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/package.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/package.mustache new file mode 100644 index 00000000000..fae4aca2ac3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/package.mustache @@ -0,0 +1,71 @@ +{ + "name": "{{{npmName}}}", + "version": "{{{npmVersion}}}", + "description": "REST client for {{{npmName}}}", + "author": "OpenAPI Generator Contributors", + "keywords": [ + "swagger-client" + ], + "license": "Unlicense", + "scripts": { + "build": "tsc -p tsconfig.build.json", + "build:clean": "rm -rf dist/ 2> /dev/null && tsc -p tsconfig.build.json", + "format": "prettier --write \"src/**/*.ts\"", + "start": "ts-node -r tsconfig-paths/register src/main.ts", + "start:dev": "concurrently --handle-input \"wait-on dist/main.js && nodemon\" \"tsc -w -p tsconfig.build.json\" ", + "start:debug": "nodemon --config nodemon-debug.json", + "prestart:prod": "rimraf dist && npm run build", + "start:prod": "node dist/main.js", + "lint": "tslint -p tsconfig.json -c tslint.json", + "lint:fix": "tslint -p tsconfig.json -c tslint.json --fix --force", + "test": "jest", + "test:watch": "jest --watch", + "test:cov": "jest --coverage", + "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", + "test:e2e": "jest --config ./test/jest-e2e.json" + }, + "dependencies": { + "@nestjs/common": "^{{nestVersion}}", + "@nestjs/core": "^{{nestVersion}}", + "@nestjs/platform-express": "^{{nestVersion}}", + "reflect-metadata": "^0.1.13", + "rimraf": "^2.6.3", + "rxjs": "^6.5.2" + }, + "devDependencies": { + "@nestjs/testing": "~{{nestVersion}}", + "@types/express": "^4.16.0", + "@types/jest": "^24.0.15", + "@types/node": "^12.6.1", + "@types/supertest": "^2.0.8", + "concurrently": "^4.1.1", + "nodemon": "^1.19.1", + "prettier": "^1.18.2", + "supertest": "^4.0.2", + "ts-jest": "24.0.2", + "ts-node": "8.3.0", + "tsconfig-paths": "3.8.0", + "tslint": "5.18.0", + "typescript": "3.5.3", + "wait-on": "^3.2.0" + }, + "jest": { + "moduleFileExtensions": [ + "js", + "json", + "ts" + ], + "rootDir": "src", + "testRegex": ".spec.ts$", + "transform": { + "^.+\\.(t|j)s$": "ts-jest" + }, + "coverageDirectory": "../coverage", + "testEnvironment": "node" + }{{#npmRepository}},{{/npmRepository}} +{{#npmRepository}} + "publishConfig": { + "registry": "{{{npmRepository}}}" + } +{{/npmRepository}} +} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.build.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.build.mustache new file mode 100644 index 00000000000..77f0c6a75e9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.build.mustache @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "exclude": [ + "node_modules", + "test", + "dist", + "**/*spec.ts" + ] + } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.mustache new file mode 100644 index 00000000000..f617a139740 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.mustache @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", + "sourceMap": true, + "outDir": "./dist", + "baseUrl": "./", + "incremental": true + }, + "exclude": [ + "node_modules", + "dist" + ], + "filesGlob": [ + "./model/*.ts", + "./api/*.ts" + ] +} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/tslint.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/tslint.mustache new file mode 100644 index 00000000000..5651b2f3db0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/tslint.mustache @@ -0,0 +1,18 @@ +{ + "defaultSeverity": "error", + "extends": ["tslint:recommended"], + "jsRules": { + "no-unused-expression": true + }, + "rules": { + "quotemark": [true, "single"], + "member-access": [false], + "ordered-imports": [false], + "max-line-length": [true, 150], + "member-ordering": [false], + "interface-name": [false], + "arrow-parens": false, + "object-literal-sort-keys": false + }, + "rulesDirectory": [] +} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/variables.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/variables.mustache new file mode 100644 index 00000000000..d52a33f70e5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/variables.mustache @@ -0,0 +1,7 @@ + +export const COLLECTION_FORMATS = { + 'csv': ',', + 'tsv': ' ', + 'ssv': ' ', + 'pipes': '|' +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNestjsClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNestjsClientOptionsProvider.java new file mode 100644 index 00000000000..ee49aa17dd8 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNestjsClientOptionsProvider.java @@ -0,0 +1,92 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.options; + +import com.google.common.collect.ImmutableMap; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen; +import org.openapitools.codegen.languages.TypeScriptNestjsClientCodegen; + +import java.util.Map; + +public class TypeScriptNestjsClientOptionsProvider implements OptionsProvider { + public static final String SUPPORTS_ES6_VALUE = "false"; + public static final String NULL_SAFE_ADDITIONAL_PROPS_VALUE = "false"; + public static final String ENUM_NAME_SUFFIX = "Enum"; + public static final String STRING_ENUMS_VALUE = "false"; + public static final String SORT_PARAMS_VALUE = "false"; + public static final String SORT_MODEL_PROPERTIES_VALUE = "false"; + public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; + public static final String ENUM_PROPERTY_NAMING_VALUE = "PascalCase"; + public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; + private static final String NMP_NAME = "npmName"; + private static final String NMP_VERSION = "1.1.2"; + private static final String NPM_REPOSITORY = "https://registry.npmjs.org"; + public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; + public static final String NEST_VERSION = "6"; + public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; + public static final String FILE_NAMING_VALUE = "camelCase"; + public static final String API_MODULE_PREFIX = ""; + public static String SERVICE_SUFFIX = "Service"; + public static String SERVICE_FILE_SUFFIX = ".service"; + public static String MODEL_SUFFIX = ""; + public static String MODEL_FILE_SUFFIX = ""; + + @Override + public String getLanguage() { + return "typescript-nestjs"; + } + + @Override + public Map createOptions() { + ImmutableMap.Builder builder = new ImmutableMap.Builder(); + return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) + .put(CodegenConstants.SORT_MODEL_PROPERTIES_BY_REQUIRED_FLAG, SORT_MODEL_PROPERTIES_VALUE) + .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) + .put(CodegenConstants.ENUM_PROPERTY_NAMING, ENUM_PROPERTY_NAMING_VALUE) + .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) + .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) + .put(AbstractTypeScriptClientCodegen.NULL_SAFE_ADDITIONAL_PROPS, NULL_SAFE_ADDITIONAL_PROPS_VALUE) + .put(CodegenConstants.ENUM_NAME_SUFFIX, ENUM_NAME_SUFFIX) + .put(TypeScriptNestjsClientCodegen.STRING_ENUMS, STRING_ENUMS_VALUE) + .put(TypeScriptNestjsClientCodegen.NPM_NAME, NMP_NAME) + .put(TypeScriptNestjsClientCodegen.NPM_VERSION, NMP_VERSION) + .put(TypeScriptNestjsClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) + .put(TypeScriptNestjsClientCodegen.WITH_INTERFACES, Boolean.FALSE.toString()) + //.put(TypeScriptNestjsClientCodegen.USE_SINGLE_REQUEST_PARAMETER, Boolean.FALSE.toString()) + //.put(TypeScriptNestjsClientCodegen.PROVIDED_IN_ROOT, Boolean.FALSE.toString()) + .put(TypeScriptNestjsClientCodegen.TAGGED_UNIONS, Boolean.FALSE.toString()) + .put(TypeScriptNestjsClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) + .put(TypeScriptNestjsClientCodegen.NEST_VERSION, NEST_VERSION) + //.put(TypeScriptNestjsClientCodegen.API_MODULE_PREFIX, API_MODULE_PREFIX) + .put(TypeScriptNestjsClientCodegen.SERVICE_SUFFIX, SERVICE_SUFFIX) + .put(TypeScriptNestjsClientCodegen.SERVICE_FILE_SUFFIX, SERVICE_FILE_SUFFIX) + .put(TypeScriptNestjsClientCodegen.MODEL_SUFFIX, MODEL_SUFFIX) + .put(TypeScriptNestjsClientCodegen.MODEL_FILE_SUFFIX, MODEL_FILE_SUFFIX) + .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) + .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") + .put(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, "true") + .put(TypeScriptNestjsClientCodegen.FILE_NAMING, FILE_NAMING_VALUE) + .build(); + } + + @Override + public boolean isServer() { + return false; + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientCodegenTest.java new file mode 100644 index 00000000000..43775c64132 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientCodegenTest.java @@ -0,0 +1,135 @@ +package org.openapitools.codegen.typescript.typescriptnestjs; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.PathItem; +import io.swagger.v3.oas.models.media.ComposedSchema; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.responses.ApiResponse; +import io.swagger.v3.oas.models.responses.ApiResponses; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.TestUtils; +import org.openapitools.codegen.languages.TypeScriptNestjsClientCodegen; +import org.testng.Assert; +import org.testng.annotations.Test; + + +public class TypeScriptNestjsClientCodegenTest { + @Test + public void testModelFileSuffix() { + TypeScriptNestjsClientCodegen codegen = new TypeScriptNestjsClientCodegen(); + codegen.additionalProperties().put("modelFileSuffix", "MySuffix"); + codegen.additionalProperties().put("modelSuffix", "MySuffix"); + codegen.processOpts(); + + Assert.assertEquals("testNameMySuffix", codegen.toModelFilename("testName")); + } + + @Test + public void testOperationIdParser() { + OpenAPI openAPI = TestUtils.createOpenAPI(); + Operation operation1 = new Operation().operationId("123_test_@#$%_special_tags").responses(new ApiResponses().addApiResponse("201", new ApiResponse().description("OK"))); + openAPI.path("another-fake/dummy/", new PathItem().get(operation1)); + final TypeScriptNestjsClientCodegen codegen = new TypeScriptNestjsClientCodegen(); + codegen.setOpenAPI(openAPI); + + CodegenOperation co1 = codegen.fromOperation("/another-fake/dummy/", "get", operation1, null); + org.testng.Assert.assertEquals(co1.operationId, "_123testSpecialTags"); + + } + + @Test + public void testSnapshotVersion() { + OpenAPI openAPI = TestUtils.createOpenAPI(); + + TypeScriptNestjsClientCodegen codegen = new TypeScriptNestjsClientCodegen(); + codegen.additionalProperties().put("npmName", "@openapi/typescript-nestjs-petstore"); + codegen.additionalProperties().put("snapshot", true); + codegen.additionalProperties().put("npmVersion", "1.0.0-SNAPSHOT"); + codegen.processOpts(); + codegen.preprocessOpenAPI(openAPI); + + Assert.assertTrue(codegen.getNpmVersion().matches("^1.0.0-SNAPSHOT.[0-9]{12}$")); + + codegen = new TypeScriptNestjsClientCodegen(); + codegen.additionalProperties().put("npmName", "@openapi/typescript-nestjs-petstore"); + codegen.additionalProperties().put("snapshot", true); + codegen.additionalProperties().put("npmVersion", "3.0.0-M1"); + codegen.processOpts(); + codegen.preprocessOpenAPI(openAPI); + + Assert.assertTrue(codegen.getNpmVersion().matches("^3.0.0-M1-SNAPSHOT.[0-9]{12}$")); + + } + + @Test + public void testWithoutSnapshotVersion() { + OpenAPI openAPI = TestUtils.createOpenAPI(); + + TypeScriptNestjsClientCodegen codegen = new TypeScriptNestjsClientCodegen(); + codegen.additionalProperties().put("npmName", "@openapi/typescript-nestjs-petstore"); + codegen.additionalProperties().put("snapshot", false); + codegen.additionalProperties().put("npmVersion", "1.0.0-SNAPSHOT"); + codegen.processOpts(); + codegen.preprocessOpenAPI(openAPI); + + Assert.assertTrue(codegen.getNpmVersion().matches("^1.0.0-SNAPSHOT$")); + + codegen = new TypeScriptNestjsClientCodegen(); + codegen.additionalProperties().put("npmName", "@openapi/typescript-nestjs-petstore"); + codegen.additionalProperties().put("snapshot", false); + codegen.additionalProperties().put("npmVersion", "3.0.0-M1"); + codegen.processOpts(); + codegen.preprocessOpenAPI(openAPI); + + Assert.assertTrue(codegen.getNpmVersion().matches("^3.0.0-M1$")); + + } + + @Test + public void testRemovePrefixSuffix() { + TypeScriptNestjsClientCodegen codegen = new TypeScriptNestjsClientCodegen(); + + // simple noop test + Assert.assertEquals("TestName", codegen.removeModelPrefixSuffix("TestName")); + + codegen.setModelNamePrefix("abc"); + codegen.setModelNameSuffix("def"); + codegen.additionalProperties().put("modelSuffix", "Ghi"); + codegen.processOpts(); + + Assert.assertEquals("TestName", codegen.removeModelPrefixSuffix("TestName")); + Assert.assertEquals("TestName", codegen.removeModelPrefixSuffix("TestNameGhi")); + Assert.assertEquals("TestNameghi", codegen.removeModelPrefixSuffix("TestNameghi")); + Assert.assertEquals("abcTestName", codegen.removeModelPrefixSuffix("abcTestName")); + Assert.assertEquals("TestName", codegen.removeModelPrefixSuffix("AbcTestName")); + Assert.assertEquals("AbcTestName", codegen.removeModelPrefixSuffix("AbcAbcTestName")); + Assert.assertEquals("TestName", codegen.removeModelPrefixSuffix("TestNameDef")); + Assert.assertEquals("TestNamedef", codegen.removeModelPrefixSuffix("TestNamedef")); + Assert.assertEquals("TestNamedefghi", codegen.removeModelPrefixSuffix("TestNamedefghi")); + Assert.assertEquals("TestNameDefghi", codegen.removeModelPrefixSuffix("TestNameDefghi")); + Assert.assertEquals("TestName", codegen.removeModelPrefixSuffix("TestNameDefGhi")); + } + + @Test + public void testSchema() { + TypeScriptNestjsClientCodegen codegen = new TypeScriptNestjsClientCodegen(); + + ComposedSchema composedSchema = new ComposedSchema(); + + Schema schema1 = new Schema<>(); + schema1.set$ref("SchemaOne"); + Schema schema2 = new Schema<>(); + schema2.set$ref("SchemaTwo"); + Schema schema3 = new Schema<>(); + schema3.set$ref("SchemaThree"); + + composedSchema.addAnyOfItem(schema1); + composedSchema.addAnyOfItem(schema2); + composedSchema.addAnyOfItem(schema3); + + String schemaType = codegen.getSchemaType(composedSchema); + Assert.assertEquals(schemaType, "SchemaOne | SchemaTwo | SchemaThree"); + } + +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientOptionsTest.java new file mode 100644 index 00000000000..a2d137537fb --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientOptionsTest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.typescript.typescriptnestjs; + +import org.openapitools.codegen.AbstractOptionsTest; +import org.openapitools.codegen.CodegenConfig; +import org.openapitools.codegen.languages.TypeScriptNestjsClientCodegen; +import org.openapitools.codegen.options.TypeScriptNestjsClientOptionsProvider; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +public class TypeScriptNestjsClientOptionsTest extends AbstractOptionsTest { + + private TypeScriptNestjsClientCodegen clientCodegen = mock(TypeScriptNestjsClientCodegen.class, mockSettings); + + public TypeScriptNestjsClientOptionsTest() { + super(new TypeScriptNestjsClientOptionsProvider()); + } + + @Override + protected CodegenConfig getCodegenConfig() { + return clientCodegen; + } + + @SuppressWarnings("unused") + @Override + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptNestjsClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setModelPropertyNaming(TypeScriptNestjsClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); + verify(clientCodegen).setSupportsES6(Boolean.valueOf(TypeScriptNestjsClientOptionsProvider.SUPPORTS_ES6_VALUE)); + verify(clientCodegen).setStringEnums(Boolean.parseBoolean(TypeScriptNestjsClientOptionsProvider.STRING_ENUMS_VALUE)); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptNestjsClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsModelTest.java new file mode 100644 index 00000000000..1ea2ed86c06 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsModelTest.java @@ -0,0 +1,236 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.typescript.typescriptnestjs; + +import com.google.common.collect.Sets; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.media.*; +import io.swagger.v3.parser.util.SchemaTypeUtil; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenProperty; +import org.openapitools.codegen.DefaultCodegen; +import org.openapitools.codegen.TestUtils; +import org.openapitools.codegen.languages.TypeScriptNestjsClientCodegen; +import org.testng.Assert; +import org.testng.annotations.Test; + +@SuppressWarnings("static-method") +public class TypeScriptNestjsModelTest { + + @Test(description = "convert a simple TypeScript Nestjs model") + public void simpleModelTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT)) + .addProperties("name", new StringSchema()) + .addProperties("createdAt", new DateTimeSchema()) + .addProperties("birthDate", new DateSchema()) + .addRequiredItem("id") + .addRequiredItem("name"); + final DefaultCodegen codegen = new TypeScriptNestjsClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 4); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "number"); + Assert.assertEquals(property1.name, "id"); + Assert.assertEquals(property1.defaultValue, "undefined"); + Assert.assertEquals(property1.baseType, "number"); + Assert.assertTrue(property1.required); + Assert.assertFalse(property1.isContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "name"); + Assert.assertEquals(property2.dataType, "string"); + Assert.assertEquals(property2.name, "name"); + Assert.assertEquals(property2.defaultValue, "undefined"); + Assert.assertEquals(property2.baseType, "string"); + Assert.assertTrue(property2.required); + Assert.assertFalse(property2.isContainer); + + final CodegenProperty property3 = cm.vars.get(2); + Assert.assertEquals(property3.baseName, "createdAt"); + Assert.assertEquals(property3.complexType, null); + Assert.assertEquals(property3.dataType, "string"); + Assert.assertEquals(property3.name, "createdAt"); + Assert.assertEquals(property3.baseType, "string"); + Assert.assertEquals(property3.defaultValue, "undefined"); + Assert.assertFalse(property3.required); + Assert.assertFalse(property3.isContainer); + + final CodegenProperty property4 = cm.vars.get(3); + Assert.assertEquals(property4.baseName, "birthDate"); + Assert.assertEquals(property4.complexType, null); + Assert.assertEquals(property4.dataType, "string"); + Assert.assertEquals(property4.name, "birthDate"); + Assert.assertEquals(property4.baseType, "string"); + Assert.assertEquals(property4.defaultValue, "undefined"); + Assert.assertFalse(property4.required); + Assert.assertFalse(property4.isContainer); + } + + @Test(description = "convert a model with list property") + public void listPropertyTest() { + final Schema schema = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT)) + .addProperties("urls", new ArraySchema().items(new StringSchema())) + .addRequiredItem("id"); + final DefaultCodegen codegen = new TypeScriptNestjsClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", schema); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 2); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "number"); + Assert.assertEquals(property1.name, "id"); + Assert.assertEquals(property1.defaultValue, "undefined"); + Assert.assertEquals(property1.baseType, "number"); + Assert.assertTrue(property1.required); + Assert.assertFalse(property1.isContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "urls"); + Assert.assertEquals(property2.dataType, "Array"); + Assert.assertEquals(property2.name, "urls"); + Assert.assertEquals(property2.baseType, "Array"); + Assert.assertFalse(property2.required); + } + + @Test(description = "convert a model with complex property") + public void complexPropertyTest() { + final Schema schema = new Schema() + .description("a sample model") + .addProperties("children", new Schema().$ref("#/definitions/Children")); + final DefaultCodegen codegen = new TypeScriptNestjsClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", schema); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.dataType, "Children"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.defaultValue, "undefined"); + Assert.assertEquals(property1.baseType, "Children"); + Assert.assertFalse(property1.required); + } + + @Test(description = "convert a model with complex list property") + public void complexListPropertyTest() { + final Schema schema = new Schema() + .description("a sample model") + .addProperties("children", new ArraySchema() + .items(new Schema().$ref("#/definitions/Children"))); + final DefaultCodegen codegen = new TypeScriptNestjsClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", schema); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.complexType, "Children"); + Assert.assertEquals(property1.dataType, "Array"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.baseType, "Array"); + Assert.assertFalse(property1.required); + } + + @Test(description = "convert an array model") + public void arrayModelTest() { + final Schema schema = new ArraySchema() + .items(new Schema().$ref("#/definitions/Children")) + .description("an array model"); + final DefaultCodegen codegen = new TypeScriptNestjsClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", schema); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "an array model"); + Assert.assertEquals(cm.vars.size(), 0); + } + + @Test(description = "convert a map model") + public void mapModelTest() { + final Schema schema = new Schema() + .description("a map model") + .additionalProperties(new Schema().$ref("#/definitions/Children")); + final DefaultCodegen codegen = new TypeScriptNestjsClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", schema); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a map model"); + Assert.assertEquals(cm.vars.size(), 0); + Assert.assertEquals(cm.imports.size(), 1); + Assert.assertEquals(cm.additionalPropertiesType, "Children"); + Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); + } + + @Test(description = "convert a model with a name starting with decimal") + public void beginDecimalNameTest() { + final Schema schema = new Schema() + .description("a model with a name starting with decimal") + .addProperties("1list", new StringSchema()) + .addRequiredItem("1list"); + final DefaultCodegen codegen = new TypeScriptNestjsClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", schema); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property = cm.vars.get(0); + Assert.assertEquals(property.baseName, "1list"); + Assert.assertEquals(property.dataType, "string"); + Assert.assertEquals(property.name, "_1list"); + Assert.assertEquals(property.defaultValue, "undefined"); + Assert.assertEquals(property.baseType, "string"); + Assert.assertTrue(property.required); + Assert.assertFalse(property.isContainer); + } + +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsAdditionalPropertiesIntegrationTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsAdditionalPropertiesIntegrationTest.java new file mode 100644 index 00000000000..e0ab5cd60cf --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsAdditionalPropertiesIntegrationTest.java @@ -0,0 +1,48 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.typescript.typescriptnestjs; + +import org.openapitools.codegen.AbstractIntegrationTest; +import org.openapitools.codegen.CodegenConfig; +import org.openapitools.codegen.languages.TypeScriptNestjsClientCodegen; +import org.openapitools.codegen.testutils.IntegrationTestPathsConfig; + +import java.util.HashMap; +import java.util.Map; + +public class TypescriptNestjsAdditionalPropertiesIntegrationTest extends AbstractIntegrationTest { + + @Override + protected CodegenConfig getCodegenConfig() { + return new TypeScriptNestjsClientCodegen(); + } + + @Override + protected Map configProperties() { + Map properties = new HashMap<>(); + properties.put("npmName", "additionalPropertiesTest"); + properties.put("npmVersion", "1.0.2"); + properties.put("snapshot", "false"); + + return properties; + } + + @Override + protected IntegrationTestPathsConfig getIntegrationTestPathsConfig() { + return new IntegrationTestPathsConfig("typescript/additional-properties"); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsApiVersionTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsApiVersionTest.java new file mode 100644 index 00000000000..e767a1eeb07 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsApiVersionTest.java @@ -0,0 +1,52 @@ +package org.openapitools.codegen.typescript.typescriptnestjs; + +import io.swagger.v3.oas.models.OpenAPI; +import org.openapitools.codegen.TestUtils; +import org.openapitools.codegen.languages.TypeScriptNestjsClientCodegen; +import org.testng.Assert; +import org.testng.annotations.Test; + +public class TypescriptNestjsApiVersionTest { + + @Test(description = "tests if API version specification is used if no version is provided in additional properties") + public void testWithApiVersion() { + final TypeScriptNestjsClientCodegen codegen = new TypeScriptNestjsClientCodegen(); + + codegen.additionalProperties().put("npmName", "just-a-test"); + + OpenAPI api = TestUtils.createOpenAPI(); + codegen.processOpts(); + codegen.preprocessOpenAPI(api); + + Assert.assertEquals(codegen.getNpmVersion(), "1.0.7"); + } + + @Test(description = "tests if npmVersion additional property is used") + public void testWithNpmVersion() { + final TypeScriptNestjsClientCodegen codegen = new TypeScriptNestjsClientCodegen(); + + codegen.additionalProperties().put("npmName", "just-a-test"); + codegen.additionalProperties().put("npmVersion", "2.0.0"); + + OpenAPI api = TestUtils.createOpenAPI(); + codegen.processOpts(); + codegen.preprocessOpenAPI(api); + + Assert.assertEquals(codegen.getNpmVersion(), "2.0.0"); + } + + @Test(description = "tests if default version is used when neither OpenAPI version nor npmVersion additional property has been provided") + public void testWithoutApiVersion() { + final TypeScriptNestjsClientCodegen codegen = new TypeScriptNestjsClientCodegen(); + + codegen.additionalProperties().put("npmName", "just-a-test"); + + OpenAPI api = TestUtils.createOpenAPI(); + api.getInfo().setVersion(null); + codegen.processOpts(); + codegen.preprocessOpenAPI(api); + + Assert.assertEquals(codegen.getNpmVersion(), "1.0.0"); + } + +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsArrayAndObjectIntegrationTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsArrayAndObjectIntegrationTest.java new file mode 100644 index 00000000000..15d19d42af2 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsArrayAndObjectIntegrationTest.java @@ -0,0 +1,48 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.typescript.typescriptnestjs; + +import org.openapitools.codegen.AbstractIntegrationTest; +import org.openapitools.codegen.CodegenConfig; +import org.openapitools.codegen.languages.TypeScriptNestjsClientCodegen; +import org.openapitools.codegen.testutils.IntegrationTestPathsConfig; + +import java.util.HashMap; +import java.util.Map; + +public class TypescriptNestjsArrayAndObjectIntegrationTest extends AbstractIntegrationTest { + + @Override + protected CodegenConfig getCodegenConfig() { + return new TypeScriptNestjsClientCodegen(); + } + + @Override + protected Map configProperties() { + Map properties = new HashMap<>(); + properties.put("npmName", "arrayAndAnyTest"); + properties.put("npmVersion", "1.0.2"); + properties.put("snapshot", "false"); + + return properties; + } + + @Override + protected IntegrationTestPathsConfig getIntegrationTestPathsConfig() { + return new IntegrationTestPathsConfig("typescript/array-and-object"); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsPestoreIntegrationTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsPestoreIntegrationTest.java new file mode 100644 index 00000000000..b8cb270bec6 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypescriptNestjsPestoreIntegrationTest.java @@ -0,0 +1,48 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.typescript.typescriptnestjs; + +import org.openapitools.codegen.AbstractIntegrationTest; +import org.openapitools.codegen.CodegenConfig; +import org.openapitools.codegen.languages.TypeScriptNestjsClientCodegen; +import org.openapitools.codegen.testutils.IntegrationTestPathsConfig; + +import java.util.HashMap; +import java.util.Map; + +public class TypescriptNestjsPestoreIntegrationTest extends AbstractIntegrationTest { + + @Override + protected CodegenConfig getCodegenConfig() { + return new TypeScriptNestjsClientCodegen(); + } + + @Override + protected Map configProperties() { + Map properties = new HashMap<>(); + properties.put("npmName", "petstore-integration-test"); + properties.put("npmVersion", "1.0.3"); + properties.put("snapshot", "false"); + + return properties; + } + + @Override + protected IntegrationTestPathsConfig getIntegrationTestPathsConfig() { + return new IntegrationTestPathsConfig("typescript/petstore"); + } +} diff --git a/pom.xml b/pom.xml index c6537ebf551..bb2c66cc2ea 100644 --- a/pom.xml +++ b/pom.xml @@ -1225,6 +1225,8 @@ samples/client/petstore/typescript-axios/tests/default samples/client/petstore/typescript-node/npm samples/client/petstore/typescript-rxjs/builds/with-npm-version + diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.gitignore b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.gitignore new file mode 100644 index 00000000000..149b5765472 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator-ignore b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/FILES b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/FILES new file mode 100644 index 00000000000..d51e5a9a8bc --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/FILES @@ -0,0 +1,22 @@ +.gitignore +README.md +api.module.ts +api/api.ts +api/pet.service.ts +api/store.service.ts +api/user.service.ts +configuration.ts +git_push.sh +index.ts +model/apiResponse.ts +model/category.ts +model/models.ts +model/order.ts +model/pet.ts +model/tag.ts +model/user.ts +package.json +tsconfig.build.json +tsconfig.json +tslint.json +variables.ts diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/VERSION b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/VERSION new file mode 100644 index 00000000000..3fa3b389a57 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/README.md b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/README.md new file mode 100644 index 00000000000..891ce865fd8 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/README.md @@ -0,0 +1,137 @@ +## @openapitools/typescript-nestjs-petstore@1.0.0 + +### Building + +To install the required dependencies and to build the typescript sources run: +``` +npm install +npm run build +``` + +#### General usage + +In your Nestjs project: + + +``` +// without configuring providers +import { ApiModule } from '@openapitools/typescript-nestjs-petstore'; +import { HttpModule } from '@nestjs/common'; + +@Module({ + imports: [ + ApiModule, + HttpModule + ], + providers: [] +}) +export class AppModule {} +``` + +``` +// configuring providers +import { ApiModule, Configuration, ConfigurationParameters } from '@openapitools/typescript-nestjs-petstore'; + +export function apiConfigFactory (): Configuration => { + const params: ConfigurationParameters = { + // set configuration parameters here. + } + return new Configuration(params); +} + +@Module({ + imports: [ ApiModule.forRoot(apiConfigFactory) ], + declarations: [ AppComponent ], + providers: [], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + +``` +import { DefaultApi } from '@openapitools/typescript-nestjs-petstore'; + +export class AppComponent { + constructor(private apiGateway: DefaultApi) { } +} +``` + +Note: The ApiModule a dynamic module and instantiated once app wide. +This is to ensure that all services are treated as singletons. + +#### Using multiple swagger files / APIs / ApiModules +In order to use multiple `ApiModules` generated from different swagger files, +you can create an alias name when importing the modules +in order to avoid naming conflicts: +``` +import { ApiModule } from 'my-api-path'; +import { ApiModule as OtherApiModule } from 'my-other-api-path'; +import { HttpModule } from '@nestjs/common'; + +@Module({ + imports: [ + ApiModule, + OtherApiModule, + HttpModule + ] +}) +export class AppModule { + +} +``` + + +### Set service base path +If different than the generated base path, during app bootstrap, you can provide the base path to your service. + +``` +import { BASE_PATH } from '@openapitools/typescript-nestjs-petstore'; + +bootstrap(AppComponent, [ + { provide: BASE_PATH, useValue: 'https://your-web-service.com' }, +]); +``` +or + +``` +import { BASE_PATH } from '@openapitools/typescript-nestjs-petstore'; + +@Module({ + imports: [], + declarations: [ AppComponent ], + providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + + +#### Using @nestjs/cli +First extend your `src/environments/*.ts` files by adding the corresponding base path: + +``` +export const environment = { + production: false, + API_BASE_PATH: 'http://127.0.0.1:8080' +}; +``` + +In the src/app/app.module.ts: +``` +import { BASE_PATH } from '@openapitools/typescript-nestjs-petstore'; +import { environment } from '../environments/environment'; + +@Module({ + declarations: [ + AppComponent + ], + imports: [ ], + providers: [ + { + provide: 'BASE_PATH', + useValue: environment.API_BASE_PATH + } + ] +}) +export class AppModule { } +``` \ No newline at end of file diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api.module.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api.module.ts new file mode 100644 index 00000000000..3e56bd5c091 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api.module.ts @@ -0,0 +1,28 @@ +import { DynamicModule, HttpService, HttpModule, Module, Global } from '@nestjs/common'; +import { Configuration } from './configuration'; +import { BASE_PATH } from './variables'; + +import { PetService } from './api/pet.service'; +import { StoreService } from './api/store.service'; +import { UserService } from './api/user.service'; + +@Global +@Module({ + imports: [ HttpModule ], + exports: [ + PetServiceStoreServiceUserService + ], + providers: [ + PetServiceStoreServiceUserService + ] +}) +export class ApiModule { + public static forRoot(configurationFactory: () => Configuration): DynamicModule { + return { + module: ApiModule, + providers: [ { provide: Configuration, useFactory: configurationFactory } ] + }; + } + + constructor( httpService: HttpService) { } +} diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/api.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/api.ts new file mode 100644 index 00000000000..8e44b64083d --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/api.ts @@ -0,0 +1,7 @@ +export * from './pet.service'; +import { PetService } from './pet.service'; +export * from './store.service'; +import { StoreService } from './store.service'; +export * from './user.service'; +import { UserService } from './user.service'; +export const APIS = [PetService, StoreService, UserService]; diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts new file mode 100644 index 00000000000..554608d8f0d --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts @@ -0,0 +1,478 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { HttpService, Inject, Injectable } from '@nestjs/common'; +import { AxiosResponse } from 'axios'; +import { Observable } from 'rxjs'; +import { ApiResponse } from '../model/apiResponse'; +import { Pet } from '../model/pet'; +import { Configuration } from '../configuration'; +import { COLLECTION_FORMATS } from '../variables'; + + +@Injectable() +export class PetService { + + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders = new Map() + public configuration = new Configuration(); + + constructor(protected httpClient: HttpService, configuration: Configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + return consumes.includes(form); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public addPet(pet: Pet, ): Observable>; + public addPet(pet: Pet, ): Observable { + + if (pet === null || pet === undefined) { + throw new Error('Required parameter pet was null or undefined when calling addPet.'); + } + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml' + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + 'application/xml' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + + return this.httpClient.post(`${this.basePath}/pet`, + pet, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deletePet(petId: number, apiKey?: string, ): Observable>; + public deletePet(petId: number, apiKey?: string, ): Observable { + + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling deletePet.'); + } + + + let headers = this.defaultHeaders; + if (apiKey !== undefined && apiKey !== null) { + headers['api_key'] String(apiKey); + } + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.delete(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, ): Observable>>; + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, ): Observable { + + if (status === null || status === undefined) { + throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); + } + + let queryParameters = {}; + if (status !== undefined && status !== null) { + queryParameters['status'] status; + } + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml' + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.get>(`${this.basePath}/pet/findByStatus`, + { + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public findPetsByTags(tags: Array, ): Observable>>; + public findPetsByTags(tags: Array, ): Observable { + + if (tags === null || tags === undefined) { + throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); + } + + let queryParameters = {}; + if (tags !== undefined && tags !== null) { + queryParameters['tags'] tags; + } + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml' + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.get>(`${this.basePath}/pet/findByTags`, + { + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getPetById(petId: number, ): Observable>; + public getPetById(petId: number, ): Observable { + + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling getPetById.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml' + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.get(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public updatePet(pet: Pet, ): Observable>; + public updatePet(pet: Pet, ): Observable { + + if (pet === null || pet === undefined) { + throw new Error('Required parameter pet was null or undefined when calling updatePet.'); + } + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml' + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + 'application/xml' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + + return this.httpClient.put(`${this.basePath}/pet`, + pet, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public updatePetWithForm(petId: number, name?: string, status?: string, ): Observable>; + public updatePetWithForm(petId: number, name?: string, status?: string, ): Observable { + + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + + + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/x-www-form-urlencoded' + ]; + + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void; }; + let useForm = false; + let convertFormParamsToString = false; + if (useForm) { + formParams = new FormData(); + } else { + // formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + } + + if (name !== undefined) { + formParams.append('name', name); + } + if (status !== undefined) { + formParams.append('status', status); + } + + return this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, + convertFormParamsToString ? formParams.toString() : formParams, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, ): Observable>; + public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, ): Observable { + + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); + } + + + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'multipart/form-data' + ]; + + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void; }; + let useForm = false; + let convertFormParamsToString = false; + // use FormData to transmit files using content-type "multipart/form-data" + // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data + useForm = canConsumeForm; + if (useForm) { + formParams = new FormData(); + } else { + // formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + } + + if (additionalMetadata !== undefined) { + formParams.append('additionalMetadata', additionalMetadata); + } + if (file !== undefined) { + formParams.append('file', file); + } + + return this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, + convertFormParamsToString ? formParams.toString() : formParams, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } +} diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts new file mode 100644 index 00000000000..2d5a23a5662 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts @@ -0,0 +1,194 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { HttpService, Inject, Injectable } from '@nestjs/common'; +import { AxiosResponse } from 'axios'; +import { Observable } from 'rxjs'; +import { Order } from '../model/order'; +import { Configuration } from '../configuration'; +import { COLLECTION_FORMATS } from '../variables'; + + +@Injectable() +export class StoreService { + + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders = new Map() + public configuration = new Configuration(); + + constructor(protected httpClient: HttpService, configuration: Configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + return consumes.includes(form); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deleteOrder(orderId: string, ): Observable>; + public deleteOrder(orderId: string, ): Observable { + + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); + } + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.delete(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getInventory(): Observable>; + public getInventory(): Observable { + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getOrderById(orderId: number, ): Observable>; + public getOrderById(orderId: number, ): Observable { + + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); + } + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml' + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.get(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public placeOrder(order: Order, ): Observable>; + public placeOrder(order: Order, ): Observable { + + if (order === null || order === undefined) { + throw new Error('Required parameter order was null or undefined when calling placeOrder.'); + } + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml' + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + + return this.httpClient.post(`${this.basePath}/store/order`, + order, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } +} diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts new file mode 100644 index 00000000000..e2d7034ec8d --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts @@ -0,0 +1,395 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { HttpService, Inject, Injectable } from '@nestjs/common'; +import { AxiosResponse } from 'axios'; +import { Observable } from 'rxjs'; +import { User } from '../model/user'; +import { Configuration } from '../configuration'; +import { COLLECTION_FORMATS } from '../variables'; + + +@Injectable() +export class UserService { + + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders = new Map() + public configuration = new Configuration(); + + constructor(protected httpClient: HttpService, configuration: Configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + return consumes.includes(form); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public createUser(user: User, ): Observable>; + public createUser(user: User, ): Observable { + + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUser.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + + return this.httpClient.post(`${this.basePath}/user`, + user, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Creates list of users with given input array + * + * @param user List of user object + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public createUsersWithArrayInput(user: Array, ): Observable>; + public createUsersWithArrayInput(user: Array, ): Observable { + + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUsersWithArrayInput.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + + return this.httpClient.post(`${this.basePath}/user/createWithArray`, + user, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Creates list of users with given input array + * + * @param user List of user object + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public createUsersWithListInput(user: Array, ): Observable>; + public createUsersWithListInput(user: Array, ): Observable { + + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUsersWithListInput.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + + return this.httpClient.post(`${this.basePath}/user/createWithList`, + user, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deleteUser(username: string, ): Observable>; + public deleteUser(username: string, ): Observable { + + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling deleteUser.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.delete(`${this.basePath}/user/${encodeURIComponent(String(username))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getUserByName(username: string, ): Observable>; + public getUserByName(username: string, ): Observable { + + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling getUserByName.'); + } + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml' + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.get(`${this.basePath}/user/${encodeURIComponent(String(username))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public loginUser(username: string, password: string, ): Observable>; + public loginUser(username: string, password: string, ): Observable { + + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling loginUser.'); + } + + if (password === null || password === undefined) { + throw new Error('Required parameter password was null or undefined when calling loginUser.'); + } + + let queryParameters = {}; + if (username !== undefined && username !== null) { + queryParameters['username'] username; + } + if (password !== undefined && password !== null) { + queryParameters['password'] password; + } + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml' + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.get(`${this.basePath}/user/login`, + { + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Logs out current logged in user session + * + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public logoutUser(): Observable>; + public logoutUser(): Observable { + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.get(`${this.basePath}/user/logout`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param user Updated user object + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public updateUser(username: string, user: User, ): Observable>; + public updateUser(username: string, user: User, ): Observable { + + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling updateUser.'); + } + + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling updateUser.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + + return this.httpClient.put(`${this.basePath}/user/${encodeURIComponent(String(username))}`, + user, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } +} diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/configuration.ts new file mode 100644 index 00000000000..82e8458f39e --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/configuration.ts @@ -0,0 +1,79 @@ +export interface ConfigurationParameters { + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; +} + +export class Configuration { + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; + + constructor(configurationParameters: ConfigurationParameters = {}) { + this.apiKeys = configurationParameters.apiKeys; + this.username = configurationParameters.username; + this.password = configurationParameters.password; + this.accessToken = configurationParameters.accessToken; + this.basePath = configurationParameters.basePath; + this.withCredentials = configurationParameters.withCredentials; + } + + /** + * Select the correct content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param contentTypes - the array of content types that are available for selection + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderContentType (contentTypes: string[]): string | undefined { + if (contentTypes.length == 0) { + return undefined; + } + + let type = contentTypes.find(x => this.isJsonMime(x)); + if (type === undefined) { + return contentTypes[0]; + } + return type; + } + + /** + * Select the correct accept content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param accepts - the array of content types that are available for selection. + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderAccept(accepts: string[]): string | undefined { + if (accepts.length == 0) { + return undefined; + } + + let type = accepts.find(x => this.isJsonMime(x)); + if (type === undefined) { + return accepts[0]; + } + return type; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/git_push.sh b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/git_push.sh new file mode 100644 index 00000000000..ced3be2b0c7 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/index.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/index.ts new file mode 100644 index 00000000000..c312b70fa3e --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/index.ts @@ -0,0 +1,5 @@ +export * from './api/api'; +export * from './model/models'; +export * from './variables'; +export * from './configuration'; +export * from './api.module'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/apiResponse.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/apiResponse.ts new file mode 100644 index 00000000000..682ba478921 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/apiResponse.ts @@ -0,0 +1,22 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Describes the result of uploading an image resource + */ +export interface ApiResponse { + code?: number; + type?: string; + message?: string; +} + diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/category.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/category.ts new file mode 100644 index 00000000000..b988b6827a0 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/category.ts @@ -0,0 +1,21 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * A category for a pet + */ +export interface Category { + id?: number; + name?: string; +} + diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/models.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/models.ts new file mode 100644 index 00000000000..8607c5dabd0 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/models.ts @@ -0,0 +1,6 @@ +export * from './apiResponse'; +export * from './category'; +export * from './order'; +export * from './pet'; +export * from './tag'; +export * from './user'; diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/order.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/order.ts new file mode 100644 index 00000000000..a29bebe4906 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/order.ts @@ -0,0 +1,37 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * An order for a pets from the pet store + */ +export interface Order { + id?: number; + petId?: number; + quantity?: number; + shipDate?: string; + /** + * Order Status + */ + status?: Order.StatusEnum; + complete?: boolean; +} +export namespace Order { + export type StatusEnum = 'placed' | 'approved' | 'delivered'; + export const StatusEnum = { + Placed: 'placed' as StatusEnum, + Approved: 'approved' as StatusEnum, + Delivered: 'delivered' as StatusEnum + }; +} + + diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/pet.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/pet.ts new file mode 100644 index 00000000000..e0404395f91 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/pet.ts @@ -0,0 +1,39 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { Category } from './category'; +import { Tag } from './tag'; + + +/** + * A pet for sale in the pet store + */ +export interface Pet { + id?: number; + category?: Category; + name: string; + photoUrls: Array; + tags?: Array; + /** + * pet status in the store + */ + status?: Pet.StatusEnum; +} +export namespace Pet { + export type StatusEnum = 'available' | 'pending' | 'sold'; + export const StatusEnum = { + Available: 'available' as StatusEnum, + Pending: 'pending' as StatusEnum, + Sold: 'sold' as StatusEnum + }; +} + + diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/tag.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/tag.ts new file mode 100644 index 00000000000..b6ff210e8df --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/tag.ts @@ -0,0 +1,21 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * A tag for a pet + */ +export interface Tag { + id?: number; + name?: string; +} + diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/user.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/user.ts new file mode 100644 index 00000000000..fce51005300 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/user.ts @@ -0,0 +1,30 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * A User who is purchasing from the pet store + */ +export interface User { + id?: number; + username?: string; + firstName?: string; + lastName?: string; + email?: string; + password?: string; + phone?: string; + /** + * User Status + */ + userStatus?: number; +} + diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/package.json b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/package.json new file mode 100644 index 00000000000..88bcf553b28 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/package.json @@ -0,0 +1,69 @@ +{ + "name": "@openapitools/typescript-nestjs-petstore", + "version": "1.0.0", + "description": "REST client for @openapitools/typescript-nestjs-petstore", + "author": "OpenAPI Generator Contributors", + "keywords": [ + "swagger-client" + ], + "license": "Unlicense", + "scripts": { + "build": "tsc -p tsconfig.build.json", + "build:clean": "rm -rf dist/ 2> /dev/null && tsc -p tsconfig.build.json", + "format": "prettier --write \"src/**/*.ts\"", + "start": "ts-node -r tsconfig-paths/register src/main.ts", + "start:dev": "concurrently --handle-input \"wait-on dist/main.js && nodemon\" \"tsc -w -p tsconfig.build.json\" ", + "start:debug": "nodemon --config nodemon-debug.json", + "prestart:prod": "rimraf dist && npm run build", + "start:prod": "node dist/main.js", + "lint": "tslint -p tsconfig.json -c tslint.json", + "lint:fix": "tslint -p tsconfig.json -c tslint.json --fix --force", + "test": "jest", + "test:watch": "jest --watch", + "test:cov": "jest --coverage", + "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", + "test:e2e": "jest --config ./test/jest-e2e.json" + }, + "dependencies": { + "@nestjs/common": "^6.0.0", + "@nestjs/core": "^6.0.0", + "@nestjs/platform-express": "^6.0.0", + "reflect-metadata": "^0.1.13", + "rimraf": "^2.6.3", + "rxjs": "^6.5.2" + }, + "devDependencies": { + "@nestjs/testing": "~6.0.0", + "@types/express": "^4.16.0", + "@types/jest": "^24.0.15", + "@types/node": "^12.6.1", + "@types/supertest": "^2.0.8", + "concurrently": "^4.1.1", + "nodemon": "^1.19.1", + "prettier": "^1.18.2", + "supertest": "^4.0.2", + "ts-jest": "24.0.2", + "ts-node": "8.3.0", + "tsconfig-paths": "3.8.0", + "tslint": "5.18.0", + "typescript": "3.5.3", + "wait-on": "^3.2.0" + }, + "jest": { + "moduleFileExtensions": [ + "js", + "json", + "ts" + ], + "rootDir": "src", + "testRegex": ".spec.ts$", + "transform": { + "^.+\\.(t|j)s$": "ts-jest" + }, + "coverageDirectory": "../coverage", + "testEnvironment": "node" + }, + "publishConfig": { + "registry": "https://skimdb.npmjs.com/registry" + } +} diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.build.json b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.build.json new file mode 100644 index 00000000000..77f0c6a75e9 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "exclude": [ + "node_modules", + "test", + "dist", + "**/*spec.ts" + ] + } \ No newline at end of file diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.json b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.json new file mode 100644 index 00000000000..e72eb8d5276 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es5", + "sourceMap": true, + "outDir": "./dist", + "baseUrl": "./", + "incremental": true + }, + "exclude": [ + "node_modules", + "dist" + ], + "filesGlob": [ + "./model/*.ts", + "./api/*.ts" + ] +} diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tslint.json b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tslint.json new file mode 100644 index 00000000000..5651b2f3db0 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tslint.json @@ -0,0 +1,18 @@ +{ + "defaultSeverity": "error", + "extends": ["tslint:recommended"], + "jsRules": { + "no-unused-expression": true + }, + "rules": { + "quotemark": [true, "single"], + "member-access": [false], + "ordered-imports": [false], + "max-line-length": [true, 150], + "member-ordering": [false], + "interface-name": [false], + "arrow-parens": false, + "object-literal-sort-keys": false + }, + "rulesDirectory": [] +} diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/variables.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/variables.ts new file mode 100644 index 00000000000..d52a33f70e5 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/variables.ts @@ -0,0 +1,7 @@ + +export const COLLECTION_FORMATS = { + 'csv': ',', + 'tsv': ' ', + 'ssv': ' ', + 'pipes': '|' +} From cbd2038cb50b367cc6924e1ad21c484b3c2ab1c1 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 26 Jan 2021 19:06:53 +0800 Subject: [PATCH 46/54] [Swift] move swift config files under ./bin/config (#8539) * move swift config files under ./bin/config * update bitrise config --- CI/bitrise.yml | 11 +---------- bin/configs/{other => }/swift5-alamofireLibrary.yaml | 0 bin/configs/{other => }/swift5-combineLibrary.yaml | 0 bin/configs/{other => }/swift5-default.yaml | 0 bin/configs/{other => }/swift5-deprecated.yaml | 0 bin/configs/{other => }/swift5-nonPublicApi.yaml | 0 bin/configs/{other => }/swift5-objcCompatible.yaml | 0 bin/configs/{other => }/swift5-promisekitLibrary.yaml | 0 .../{other => }/swift5-readonlyProperties.yaml | 0 bin/configs/{other => }/swift5-resultLibrary.yaml | 0 bin/configs/{other => }/swift5-rxswiftLibrary.yaml | 0 bin/configs/{other => }/swift5-urlsessionLibrary.yaml | 0 12 files changed, 1 insertion(+), 10 deletions(-) rename bin/configs/{other => }/swift5-alamofireLibrary.yaml (100%) rename bin/configs/{other => }/swift5-combineLibrary.yaml (100%) rename bin/configs/{other => }/swift5-default.yaml (100%) rename bin/configs/{other => }/swift5-deprecated.yaml (100%) rename bin/configs/{other => }/swift5-nonPublicApi.yaml (100%) rename bin/configs/{other => }/swift5-objcCompatible.yaml (100%) rename bin/configs/{other => }/swift5-promisekitLibrary.yaml (100%) rename bin/configs/{other => }/swift5-readonlyProperties.yaml (100%) rename bin/configs/{other => }/swift5-resultLibrary.yaml (100%) rename bin/configs/{other => }/swift5-rxswiftLibrary.yaml (100%) rename bin/configs/{other => }/swift5-urlsessionLibrary.yaml (100%) diff --git a/CI/bitrise.yml b/CI/bitrise.yml index f3bf6fec4c9..16084569fda 100644 --- a/CI/bitrise.yml +++ b/CI/bitrise.yml @@ -11,7 +11,7 @@ workflows: primary: steps: - git-clone@4.0.17: {} - - brew-install@0.10.2: + - brew-install@0.11.0: inputs: - packages: maven - script@1.1.6: @@ -30,15 +30,6 @@ workflows: mvn --no-snapshot-updates package -Dorg.slf4j.simpleLogger.defaultLogLevel=error title: Build openapi-generator - - script@1.1.6: - title: Update Swift samples - inputs: - - content: | - #!/usr/bin/env bash - - set -e - - bin/generate-samples.sh ./bin/configs/other/swift5-* - script@1.1.6: title: Run Swift5 tests inputs: diff --git a/bin/configs/other/swift5-alamofireLibrary.yaml b/bin/configs/swift5-alamofireLibrary.yaml similarity index 100% rename from bin/configs/other/swift5-alamofireLibrary.yaml rename to bin/configs/swift5-alamofireLibrary.yaml diff --git a/bin/configs/other/swift5-combineLibrary.yaml b/bin/configs/swift5-combineLibrary.yaml similarity index 100% rename from bin/configs/other/swift5-combineLibrary.yaml rename to bin/configs/swift5-combineLibrary.yaml diff --git a/bin/configs/other/swift5-default.yaml b/bin/configs/swift5-default.yaml similarity index 100% rename from bin/configs/other/swift5-default.yaml rename to bin/configs/swift5-default.yaml diff --git a/bin/configs/other/swift5-deprecated.yaml b/bin/configs/swift5-deprecated.yaml similarity index 100% rename from bin/configs/other/swift5-deprecated.yaml rename to bin/configs/swift5-deprecated.yaml diff --git a/bin/configs/other/swift5-nonPublicApi.yaml b/bin/configs/swift5-nonPublicApi.yaml similarity index 100% rename from bin/configs/other/swift5-nonPublicApi.yaml rename to bin/configs/swift5-nonPublicApi.yaml diff --git a/bin/configs/other/swift5-objcCompatible.yaml b/bin/configs/swift5-objcCompatible.yaml similarity index 100% rename from bin/configs/other/swift5-objcCompatible.yaml rename to bin/configs/swift5-objcCompatible.yaml diff --git a/bin/configs/other/swift5-promisekitLibrary.yaml b/bin/configs/swift5-promisekitLibrary.yaml similarity index 100% rename from bin/configs/other/swift5-promisekitLibrary.yaml rename to bin/configs/swift5-promisekitLibrary.yaml diff --git a/bin/configs/other/swift5-readonlyProperties.yaml b/bin/configs/swift5-readonlyProperties.yaml similarity index 100% rename from bin/configs/other/swift5-readonlyProperties.yaml rename to bin/configs/swift5-readonlyProperties.yaml diff --git a/bin/configs/other/swift5-resultLibrary.yaml b/bin/configs/swift5-resultLibrary.yaml similarity index 100% rename from bin/configs/other/swift5-resultLibrary.yaml rename to bin/configs/swift5-resultLibrary.yaml diff --git a/bin/configs/other/swift5-rxswiftLibrary.yaml b/bin/configs/swift5-rxswiftLibrary.yaml similarity index 100% rename from bin/configs/other/swift5-rxswiftLibrary.yaml rename to bin/configs/swift5-rxswiftLibrary.yaml diff --git a/bin/configs/other/swift5-urlsessionLibrary.yaml b/bin/configs/swift5-urlsessionLibrary.yaml similarity index 100% rename from bin/configs/other/swift5-urlsessionLibrary.yaml rename to bin/configs/swift5-urlsessionLibrary.yaml From 7654356df212d268aafcaa391cc6ab3103195aec Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 27 Jan 2021 11:14:58 +0800 Subject: [PATCH 47/54] Migrate `elixir` samples to use OAS v3 (#8538) * use 3.0 spec for testing * add new files * add 200 responses * update samples, better code format for jaxrs --- bin/configs/elixir.yaml | 2 +- .../src/main/resources/JavaJaxRS/api.mustache | 8 +- ...ith-fake-endpoints-models-for-testing.yaml | 8 ++ .../csharp/OpenAPIClient/docs/PetApi.md | 4 + .../petstore/elixir/.openapi-generator/FILES | 22 ++--- .../lib/openapi_petstore/api/another_fake.ex | 6 +- .../lib/openapi_petstore/api/default.ex | 36 ++++++++ .../elixir/lib/openapi_petstore/api/fake.ex | 74 ++++++++++++----- .../api/fake_classname_tags123.ex | 6 +- .../elixir/lib/openapi_petstore/api/pet.ex | 13 +-- .../elixir/lib/openapi_petstore/api/store.ex | 6 +- .../elixir/lib/openapi_petstore/api/user.ex | 24 +++--- .../elixir/lib/openapi_petstore/connection.ex | 36 ++++++++ .../model/_special_model_name_.ex | 25 ++++++ .../model/additional_properties_class.ex | 26 +----- .../lib/openapi_petstore/model/enum_test.ex | 13 ++- .../elixir/lib/openapi_petstore/model/foo.ex | 25 ++++++ .../lib/openapi_petstore/model/format_test.ex | 8 +- .../model/health_check_result.ex | 25 ++++++ .../model/inline_response_default.ex | 27 ++++++ .../openapi_petstore/model/nullable_class.ex | 49 +++++++++++ .../model/outer_enum_default_value.ex | 25 ++++++ .../model/outer_enum_integer.ex | 25 ++++++ .../model/outer_enum_integer_default_value.ex | 25 ++++++ .../petstore/python-legacy/docs/PetApi.md | 4 + .../org/openapitools/api/AnotherFakeApi.java | 5 +- .../java/org/openapitools/api/FakeApi.java | 77 +++++++++-------- .../api/FakeClassnameTestApi.java | 5 +- .../gen/java/org/openapitools/api/PetApi.java | 49 ++++++----- .../java/org/openapitools/api/StoreApi.java | 24 +++--- .../java/org/openapitools/api/UserApi.java | 45 +++++----- .../org/openapitools/api/AnotherFakeApi.java | 5 +- .../java/org/openapitools/api/FakeApi.java | 82 +++++++++++-------- .../api/FakeClassnameTestApi.java | 5 +- .../gen/java/org/openapitools/api/FooApi.java | 5 +- .../gen/java/org/openapitools/api/PetApi.java | 50 ++++++----- .../java/org/openapitools/api/StoreApi.java | 24 +++--- .../java/org/openapitools/api/UserApi.java | 45 +++++----- .../org/openapitools/api/AnotherFakeApi.java | 5 +- .../java/org/openapitools/api/FakeApi.java | 72 +++++++++------- .../api/FakeClassnameTags123Api.java | 5 +- .../gen/java/org/openapitools/api/PetApi.java | 54 ++++++------ .../java/org/openapitools/api/StoreApi.java | 24 +++--- .../java/org/openapitools/api/UserApi.java | 45 +++++----- .../org/openapitools/api/AnotherFakeApi.java | 5 +- .../java/org/openapitools/api/FakeApi.java | 77 +++++++++-------- .../api/FakeClassnameTestApi.java | 5 +- .../gen/java/org/openapitools/api/PetApi.java | 49 ++++++----- .../java/org/openapitools/api/StoreApi.java | 24 +++--- .../java/org/openapitools/api/UserApi.java | 45 +++++----- 50 files changed, 884 insertions(+), 469 deletions(-) create mode 100644 samples/client/petstore/elixir/lib/openapi_petstore/api/default.ex create mode 100644 samples/client/petstore/elixir/lib/openapi_petstore/model/_special_model_name_.ex create mode 100644 samples/client/petstore/elixir/lib/openapi_petstore/model/foo.ex create mode 100644 samples/client/petstore/elixir/lib/openapi_petstore/model/health_check_result.ex create mode 100644 samples/client/petstore/elixir/lib/openapi_petstore/model/inline_response_default.ex create mode 100644 samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex create mode 100644 samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_default_value.ex create mode 100644 samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer.ex create mode 100644 samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer_default_value.ex diff --git a/bin/configs/elixir.yaml b/bin/configs/elixir.yaml index 6507adae5fc..a287f44705b 100644 --- a/bin/configs/elixir.yaml +++ b/bin/configs/elixir.yaml @@ -1,6 +1,6 @@ generatorName: elixir outputDir: samples/client/petstore/elixir -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml templateDir: modules/openapi-generator/src/main/resources/elixir additionalProperties: invokerPackage: OpenapiPetstore diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/api.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/api.mustache index 714dbf9d1db..9eb362285cb 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/api.mustache @@ -71,9 +71,11 @@ public class {{classname}} { }{{/isOAuth}}){{^-last}}, {{/-last}}{{/authMethods}} }{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} }) - @io.swagger.annotations.ApiResponses(value = { {{#responses}} - @io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{^-last}}, - {{/-last}}{{/responses}} }) + @io.swagger.annotations.ApiResponses(value = { + {{#responses}} + @io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{^-last}},{{/-last}} + {{/responses}} + }) public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}}@Context SecurityContext securityContext) throws NotFoundException { return delegate.{{nickname}}({{#allParams}}{{#isFormParam}}{{#isFile}}{{paramName}}Bodypart{{/isFile}}{{/isFormParam}}{{^isFile}}{{paramName}}{{/isFile}}{{^isFormParam}}{{#isFile}}{{paramName}}{{/isFile}}{{/isFormParam}}, {{/allParams}}securityContext); diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml index 8211b6812a6..a729d26077b 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -40,6 +40,8 @@ paths: description: '' operationId: addPet responses: + '200': + description: Successful operation '405': description: Invalid input security: @@ -55,6 +57,8 @@ paths: description: '' operationId: updatePet responses: + '200': + description: Successful operation '400': description: Invalid ID supplied '404': @@ -197,6 +201,8 @@ paths: type: integer format: int64 responses: + '200': + description: Successful operation '405': description: Invalid input security: @@ -235,6 +241,8 @@ paths: type: integer format: int64 responses: + '200': + description: Successful operation '400': description: Invalid pet value security: diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/PetApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/PetApi.md index 5d9c6cb6f79..9c0cc2b2951 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/PetApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/PetApi.md @@ -83,6 +83,7 @@ void (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| +| **200** | Successful operation | - | | **405** | Invalid input | - | [[Back to top]](#) @@ -160,6 +161,7 @@ void (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| +| **200** | Successful operation | - | | **400** | Invalid pet value | - | [[Back to top]](#) @@ -475,6 +477,7 @@ void (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| +| **200** | Successful operation | - | | **400** | Invalid ID supplied | - | | **404** | Pet not found | - | | **405** | Validation exception | - | @@ -556,6 +559,7 @@ void (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| +| **200** | Successful operation | - | | **405** | Invalid input | - | [[Back to top]](#) diff --git a/samples/client/petstore/elixir/.openapi-generator/FILES b/samples/client/petstore/elixir/.openapi-generator/FILES index 2a0f057f595..a7de9eecd58 100644 --- a/samples/client/petstore/elixir/.openapi-generator/FILES +++ b/samples/client/petstore/elixir/.openapi-generator/FILES @@ -2,6 +2,7 @@ README.md config/config.exs lib/openapi_petstore/api/another_fake.ex +lib/openapi_petstore/api/default.ex lib/openapi_petstore/api/fake.ex lib/openapi_petstore/api/fake_classname_tags123.ex lib/openapi_petstore/api/pet.ex @@ -9,21 +10,13 @@ lib/openapi_petstore/api/store.ex lib/openapi_petstore/api/user.ex lib/openapi_petstore/connection.ex lib/openapi_petstore/deserializer.ex -lib/openapi_petstore/model/additional_properties_any_type.ex -lib/openapi_petstore/model/additional_properties_array.ex -lib/openapi_petstore/model/additional_properties_boolean.ex +lib/openapi_petstore/model/_special_model_name_.ex lib/openapi_petstore/model/additional_properties_class.ex -lib/openapi_petstore/model/additional_properties_integer.ex -lib/openapi_petstore/model/additional_properties_number.ex -lib/openapi_petstore/model/additional_properties_object.ex -lib/openapi_petstore/model/additional_properties_string.ex lib/openapi_petstore/model/animal.ex lib/openapi_petstore/model/api_response.ex lib/openapi_petstore/model/array_of_array_of_number_only.ex lib/openapi_petstore/model/array_of_number_only.ex lib/openapi_petstore/model/array_test.ex -lib/openapi_petstore/model/big_cat.ex -lib/openapi_petstore/model/big_cat_all_of.ex lib/openapi_petstore/model/capitalization.ex lib/openapi_petstore/model/cat.ex lib/openapi_petstore/model/cat_all_of.ex @@ -37,26 +30,29 @@ lib/openapi_petstore/model/enum_class.ex lib/openapi_petstore/model/enum_test.ex lib/openapi_petstore/model/file.ex lib/openapi_petstore/model/file_schema_test_class.ex +lib/openapi_petstore/model/foo.ex lib/openapi_petstore/model/format_test.ex lib/openapi_petstore/model/has_only_read_only.ex +lib/openapi_petstore/model/health_check_result.ex +lib/openapi_petstore/model/inline_response_default.ex lib/openapi_petstore/model/list.ex lib/openapi_petstore/model/map_test.ex lib/openapi_petstore/model/mixed_properties_and_additional_properties_class.ex lib/openapi_petstore/model/model_200_response.ex lib/openapi_petstore/model/name.ex +lib/openapi_petstore/model/nullable_class.ex lib/openapi_petstore/model/number_only.ex lib/openapi_petstore/model/order.ex lib/openapi_petstore/model/outer_composite.ex lib/openapi_petstore/model/outer_enum.ex +lib/openapi_petstore/model/outer_enum_default_value.ex +lib/openapi_petstore/model/outer_enum_integer.ex +lib/openapi_petstore/model/outer_enum_integer_default_value.ex lib/openapi_petstore/model/pet.ex lib/openapi_petstore/model/read_only_first.ex lib/openapi_petstore/model/return.ex -lib/openapi_petstore/model/special_model_name.ex lib/openapi_petstore/model/tag.ex -lib/openapi_petstore/model/type_holder_default.ex -lib/openapi_petstore/model/type_holder_example.ex lib/openapi_petstore/model/user.ex -lib/openapi_petstore/model/xml_item.ex lib/openapi_petstore/request_builder.ex mix.exs test/test_helper.exs diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/another_fake.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/another_fake.ex index 06d523d3118..110b399f33e 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/another_fake.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/another_fake.ex @@ -18,7 +18,7 @@ defmodule OpenapiPetstore.Api.AnotherFake do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body (Client): client model + - client (Client): client model - opts (KeywordList): [optional] Optional parameters ## Returns @@ -26,11 +26,11 @@ defmodule OpenapiPetstore.Api.AnotherFake do {:error, Tesla.Env.t} on failure """ @spec call_123_test_special_tags(Tesla.Env.client, OpenapiPetstore.Model.Client.t, keyword()) :: {:ok, OpenapiPetstore.Model.Client.t} | {:error, Tesla.Env.t} - def call_123_test_special_tags(connection, body, _opts \\ []) do + def call_123_test_special_tags(connection, client, _opts \\ []) do %{} |> method(:patch) |> url("/another-fake/dummy") - |> add_param(:body, :body, body) + |> add_param(:body, :body, client) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/default.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/default.ex new file mode 100644 index 00000000000..ca006e293d0 --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/default.ex @@ -0,0 +1,36 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Api.Default do + @moduledoc """ + API calls for all endpoints tagged `Default`. + """ + + alias OpenapiPetstore.Connection + import OpenapiPetstore.RequestBuilder + + + @doc """ + + ## Parameters + + - connection (OpenapiPetstore.Connection): Connection to server + - opts (KeywordList): [optional] Optional parameters + ## Returns + + {:ok, OpenapiPetstore.Model.InlineResponseDefault.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec foo_get(Tesla.Env.client, keyword()) :: {:ok, OpenapiPetstore.Model.InlineResponseDefault.t} | {:error, Tesla.Env.t} + def foo_get(connection, _opts \\ []) do + %{} + |> method(:get) + |> url("/foo") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { :default, %OpenapiPetstore.Model.InlineResponseDefault{}} + ]) + end +end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex index e43ebc24caa..b0f0c05e573 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex @@ -12,25 +12,55 @@ defmodule OpenapiPetstore.Api.Fake do @doc """ - creates an XmlItem - this route creates an XmlItem + Health check endpoint ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - xml_item (XmlItem): XmlItem Body - opts (KeywordList): [optional] Optional parameters ## Returns + {:ok, OpenapiPetstore.Model.HealthCheckResult.t} on success + {:error, Tesla.Env.t} on failure + """ + @spec fake_health_get(Tesla.Env.client, keyword()) :: {:ok, OpenapiPetstore.Model.HealthCheckResult.t} | {:error, Tesla.Env.t} + def fake_health_get(connection, _opts \\ []) do + %{} + |> method(:get) + |> url("/fake/health") + |> Enum.into([]) + |> (&Connection.request(connection, &1)).() + |> evaluate_response([ + { 200, %OpenapiPetstore.Model.HealthCheckResult{}} + ]) + end + + @doc """ + test http signature authentication + + ## Parameters + + - connection (OpenapiPetstore.Connection): Connection to server + - pet (Pet): Pet object that needs to be added to the store + - opts (KeywordList): [optional] Optional parameters + - :query1 (String.t): query parameter + - :header1 (String.t): header parameter + ## Returns + {:ok, nil} on success {:error, Tesla.Env.t} on failure """ - @spec create_xml_item(Tesla.Env.client, OpenapiPetstore.Model.XmlItem.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} - def create_xml_item(connection, xml_item, _opts \\ []) do + @spec fake_http_signature_test(Tesla.Env.client, OpenapiPetstore.Model.Pet.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} + def fake_http_signature_test(connection, pet, opts \\ []) do + optional_params = %{ + :"query_1" => :query, + :"header_1" => :headers + } %{} - |> method(:post) - |> url("/fake/create_xml_item") - |> add_param(:body, :body, xml_item) + |> method(:get) + |> url("/fake/http-signature-test") + |> add_param(:body, :body, pet) + |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -164,7 +194,7 @@ defmodule OpenapiPetstore.Api.Fake do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body (FileSchemaTestClass): + - file_schema_test_class (FileSchemaTestClass): - opts (KeywordList): [optional] Optional parameters ## Returns @@ -172,11 +202,11 @@ defmodule OpenapiPetstore.Api.Fake do {:error, Tesla.Env.t} on failure """ @spec test_body_with_file_schema(Tesla.Env.client, OpenapiPetstore.Model.FileSchemaTestClass.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} - def test_body_with_file_schema(connection, body, _opts \\ []) do + def test_body_with_file_schema(connection, file_schema_test_class, _opts \\ []) do %{} |> method(:put) |> url("/fake/body-with-file-schema") - |> add_param(:body, :body, body) + |> add_param(:body, :body, file_schema_test_class) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -190,7 +220,7 @@ defmodule OpenapiPetstore.Api.Fake do - connection (OpenapiPetstore.Connection): Connection to server - query (String.t): - - body (User): + - user (User): - opts (KeywordList): [optional] Optional parameters ## Returns @@ -198,12 +228,12 @@ defmodule OpenapiPetstore.Api.Fake do {:error, Tesla.Env.t} on failure """ @spec test_body_with_query_params(Tesla.Env.client, String.t, OpenapiPetstore.Model.User.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} - def test_body_with_query_params(connection, query, body, _opts \\ []) do + def test_body_with_query_params(connection, query, user, _opts \\ []) do %{} |> method(:put) |> url("/fake/body-with-query-params") |> add_param(:query, :"query", query) - |> add_param(:body, :body, body) + |> add_param(:body, :body, user) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -218,7 +248,7 @@ defmodule OpenapiPetstore.Api.Fake do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body (Client): client model + - client (Client): client model - opts (KeywordList): [optional] Optional parameters ## Returns @@ -226,11 +256,11 @@ defmodule OpenapiPetstore.Api.Fake do {:error, Tesla.Env.t} on failure """ @spec test_client_model(Tesla.Env.client, OpenapiPetstore.Model.Client.t, keyword()) :: {:ok, OpenapiPetstore.Model.Client.t} | {:error, Tesla.Env.t} - def test_client_model(connection, body, _opts \\ []) do + def test_client_model(connection, client, _opts \\ []) do %{} |> method(:patch) |> url("/fake") - |> add_param(:body, :body, body) + |> add_param(:body, :body, client) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -239,8 +269,8 @@ defmodule OpenapiPetstore.Api.Fake do end @doc """ - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ## Parameters @@ -386,7 +416,7 @@ defmodule OpenapiPetstore.Api.Fake do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - param (%{optional(String.t) => String.t}): request body + - request_body (%{optional(String.t) => String.t}): request body - opts (KeywordList): [optional] Optional parameters ## Returns @@ -394,11 +424,11 @@ defmodule OpenapiPetstore.Api.Fake do {:error, Tesla.Env.t} on failure """ @spec test_inline_additional_properties(Tesla.Env.client, %{optional(String.t) => String.t}, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} - def test_inline_additional_properties(connection, param, _opts \\ []) do + def test_inline_additional_properties(connection, request_body, _opts \\ []) do %{} |> method(:post) |> url("/fake/inline-additionalProperties") - |> add_param(:body, :body, param) + |> add_param(:body, :body, request_body) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake_classname_tags123.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake_classname_tags123.ex index 64a3be9ebd7..fd202abac6e 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake_classname_tags123.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake_classname_tags123.ex @@ -18,7 +18,7 @@ defmodule OpenapiPetstore.Api.FakeClassnameTags123 do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body (Client): client model + - client (Client): client model - opts (KeywordList): [optional] Optional parameters ## Returns @@ -26,11 +26,11 @@ defmodule OpenapiPetstore.Api.FakeClassnameTags123 do {:error, Tesla.Env.t} on failure """ @spec test_classname(Tesla.Env.client, OpenapiPetstore.Model.Client.t, keyword()) :: {:ok, OpenapiPetstore.Model.Client.t} | {:error, Tesla.Env.t} - def test_classname(connection, body, _opts \\ []) do + def test_classname(connection, client, _opts \\ []) do %{} |> method(:patch) |> url("/fake_classname_test") - |> add_param(:body, :body, body) + |> add_param(:body, :body, client) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex index b6a42cd7b90..4ba4b9dac96 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/pet.ex @@ -17,7 +17,7 @@ defmodule OpenapiPetstore.Api.Pet do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body (Pet): Pet object that needs to be added to the store + - pet (Pet): Pet object that needs to be added to the store - opts (KeywordList): [optional] Optional parameters ## Returns @@ -25,11 +25,11 @@ defmodule OpenapiPetstore.Api.Pet do {:error, Tesla.Env.t} on failure """ @spec add_pet(Tesla.Env.client, OpenapiPetstore.Model.Pet.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} - def add_pet(connection, body, _opts \\ []) do + def add_pet(connection, pet, _opts \\ []) do %{} |> method(:post) |> url("/pet") - |> add_param(:body, :body, body) + |> add_param(:body, :body, pet) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -159,7 +159,7 @@ defmodule OpenapiPetstore.Api.Pet do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body (Pet): Pet object that needs to be added to the store + - pet (Pet): Pet object that needs to be added to the store - opts (KeywordList): [optional] Optional parameters ## Returns @@ -167,11 +167,11 @@ defmodule OpenapiPetstore.Api.Pet do {:error, Tesla.Env.t} on failure """ @spec update_pet(Tesla.Env.client, OpenapiPetstore.Model.Pet.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} - def update_pet(connection, body, _opts \\ []) do + def update_pet(connection, pet, _opts \\ []) do %{} |> method(:put) |> url("/pet") - |> add_param(:body, :body, body) + |> add_param(:body, :body, pet) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -211,6 +211,7 @@ defmodule OpenapiPetstore.Api.Pet do |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ + { 200, false}, { 405, false} ]) end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/store.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/store.ex index d6f183ea193..fe2d5df5037 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/store.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/store.ex @@ -97,7 +97,7 @@ defmodule OpenapiPetstore.Api.Store do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body (Order): order placed for purchasing the pet + - order (Order): order placed for purchasing the pet - opts (KeywordList): [optional] Optional parameters ## Returns @@ -105,11 +105,11 @@ defmodule OpenapiPetstore.Api.Store do {:error, Tesla.Env.t} on failure """ @spec place_order(Tesla.Env.client, OpenapiPetstore.Model.Order.t, keyword()) :: {:ok, nil} | {:ok, OpenapiPetstore.Model.Order.t} | {:error, Tesla.Env.t} - def place_order(connection, body, _opts \\ []) do + def place_order(connection, order, _opts \\ []) do %{} |> method(:post) |> url("/store/order") - |> add_param(:body, :body, body) + |> add_param(:body, :body, order) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/user.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/user.ex index fd8c2d12ee0..bd6c3bc347d 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/user.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/user.ex @@ -18,7 +18,7 @@ defmodule OpenapiPetstore.Api.User do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body (User): Created user object + - user (User): Created user object - opts (KeywordList): [optional] Optional parameters ## Returns @@ -26,11 +26,11 @@ defmodule OpenapiPetstore.Api.User do {:error, Tesla.Env.t} on failure """ @spec create_user(Tesla.Env.client, OpenapiPetstore.Model.User.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} - def create_user(connection, body, _opts \\ []) do + def create_user(connection, user, _opts \\ []) do %{} |> method(:post) |> url("/user") - |> add_param(:body, :body, body) + |> add_param(:body, :body, user) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -44,7 +44,7 @@ defmodule OpenapiPetstore.Api.User do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body ([OpenapiPetstore.Model.User.t]): List of user object + - user ([OpenapiPetstore.Model.User.t]): List of user object - opts (KeywordList): [optional] Optional parameters ## Returns @@ -52,11 +52,11 @@ defmodule OpenapiPetstore.Api.User do {:error, Tesla.Env.t} on failure """ @spec create_users_with_array_input(Tesla.Env.client, list(OpenapiPetstore.Model.User.t), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} - def create_users_with_array_input(connection, body, _opts \\ []) do + def create_users_with_array_input(connection, user, _opts \\ []) do %{} |> method(:post) |> url("/user/createWithArray") - |> add_param(:body, :body, body) + |> add_param(:body, :body, user) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -70,7 +70,7 @@ defmodule OpenapiPetstore.Api.User do ## Parameters - connection (OpenapiPetstore.Connection): Connection to server - - body ([OpenapiPetstore.Model.User.t]): List of user object + - user ([OpenapiPetstore.Model.User.t]): List of user object - opts (KeywordList): [optional] Optional parameters ## Returns @@ -78,11 +78,11 @@ defmodule OpenapiPetstore.Api.User do {:error, Tesla.Env.t} on failure """ @spec create_users_with_list_input(Tesla.Env.client, list(OpenapiPetstore.Model.User.t), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} - def create_users_with_list_input(connection, body, _opts \\ []) do + def create_users_with_list_input(connection, user, _opts \\ []) do %{} |> method(:post) |> url("/user/createWithList") - |> add_param(:body, :body, body) + |> add_param(:body, :body, user) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ @@ -205,7 +205,7 @@ defmodule OpenapiPetstore.Api.User do - connection (OpenapiPetstore.Connection): Connection to server - username (String.t): name that need to be deleted - - body (User): Updated user object + - user (User): Updated user object - opts (KeywordList): [optional] Optional parameters ## Returns @@ -213,11 +213,11 @@ defmodule OpenapiPetstore.Api.User do {:error, Tesla.Env.t} on failure """ @spec update_user(Tesla.Env.client, String.t, OpenapiPetstore.Model.User.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} - def update_user(connection, username, body, _opts \\ []) do + def update_user(connection, username, user, _opts \\ []) do %{} |> method(:put) |> url("/user/#{username}") - |> add_param(:body, :body, body) + |> add_param(:body, :body, user) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex b/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex index eddf86c2f8b..4bc4ae17ce9 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex @@ -24,6 +24,42 @@ defmodule OpenapiPetstore.Connection do # Returns + Tesla.Env.client + """ + @spec new(String.t, String.t) :: Tesla.Env.client + def new(username, password) do + Tesla.client([ + {Tesla.Middleware.BasicAuth, %{username: username, password: password}} + ]) + end + @doc """ + Configure a client connection using Basic authentication. + + ## Parameters + + - username (String): Username used for authentication + - password (String): Password used for authentication + + # Returns + + Tesla.Env.client + """ + @spec new(String.t, String.t) :: Tesla.Env.client + def new(username, password) do + Tesla.client([ + {Tesla.Middleware.BasicAuth, %{username: username, password: password}} + ]) + end + @doc """ + Configure a client connection using Basic authentication. + + ## Parameters + + - username (String): Username used for authentication + - password (String): Password used for authentication + + # Returns + Tesla.Env.client """ @spec new(String.t, String.t) :: Tesla.Env.client diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/_special_model_name_.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/_special_model_name_.ex new file mode 100644 index 00000000000..429129b42a0 --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/_special_model_name_.ex @@ -0,0 +1,25 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Model.SpecialModelName do + @moduledoc """ + + """ + + @derive [Poison.Encoder] + defstruct [ + :"$special[property.name]" + ] + + @type t :: %__MODULE__{ + :"$special[property.name]" => integer() | nil + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.SpecialModelName do + def decode(value, _options) do + value + end +end + diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex index 7f44693809d..837bf62a7ce 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/additional_properties_class.ex @@ -9,31 +9,13 @@ defmodule OpenapiPetstore.Model.AdditionalPropertiesClass do @derive [Poison.Encoder] defstruct [ - :"map_string", - :"map_number", - :"map_integer", - :"map_boolean", - :"map_array_integer", - :"map_array_anytype", - :"map_map_string", - :"map_map_anytype", - :"anytype_1", - :"anytype_2", - :"anytype_3" + :"map_property", + :"map_of_map_property" ] @type t :: %__MODULE__{ - :"map_string" => %{optional(String.t) => String.t} | nil, - :"map_number" => %{optional(String.t) => float()} | nil, - :"map_integer" => %{optional(String.t) => integer()} | nil, - :"map_boolean" => %{optional(String.t) => boolean()} | nil, - :"map_array_integer" => %{optional(String.t) => [integer()]} | nil, - :"map_array_anytype" => %{optional(String.t) => [map()]} | nil, - :"map_map_string" => %{optional(String.t) => %{optional(String.t) => String.t}} | nil, - :"map_map_anytype" => %{optional(String.t) => %{optional(String.t) => map()}} | nil, - :"anytype_1" => map() | nil, - :"anytype_2" => map() | nil, - :"anytype_3" => map() | nil + :"map_property" => %{optional(String.t) => String.t} | nil, + :"map_of_map_property" => %{optional(String.t) => %{optional(String.t) => String.t}} | nil } end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex index 185067458fc..0d33162d256 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/enum_test.ex @@ -13,7 +13,10 @@ defmodule OpenapiPetstore.Model.EnumTest do :"enum_string_required", :"enum_integer", :"enum_number", - :"outerEnum" + :"outerEnum", + :"outerEnumInteger", + :"outerEnumDefaultValue", + :"outerEnumIntegerDefaultValue" ] @type t :: %__MODULE__{ @@ -21,7 +24,10 @@ defmodule OpenapiPetstore.Model.EnumTest do :"enum_string_required" => String.t, :"enum_integer" => integer() | nil, :"enum_number" => float() | nil, - :"outerEnum" => OpenapiPetstore.Model.OuterEnum.t | nil + :"outerEnum" => OpenapiPetstore.Model.OuterEnum.t | nil, + :"outerEnumInteger" => OpenapiPetstore.Model.OuterEnumInteger.t | nil, + :"outerEnumDefaultValue" => OpenapiPetstore.Model.OuterEnumDefaultValue.t | nil, + :"outerEnumIntegerDefaultValue" => OpenapiPetstore.Model.OuterEnumIntegerDefaultValue.t | nil } end @@ -30,6 +36,9 @@ defimpl Poison.Decoder, for: OpenapiPetstore.Model.EnumTest do def decode(value, options) do value |> deserialize(:"outerEnum", :struct, OpenapiPetstore.Model.OuterEnum, options) + |> deserialize(:"outerEnumInteger", :struct, OpenapiPetstore.Model.OuterEnumInteger, options) + |> deserialize(:"outerEnumDefaultValue", :struct, OpenapiPetstore.Model.OuterEnumDefaultValue, options) + |> deserialize(:"outerEnumIntegerDefaultValue", :struct, OpenapiPetstore.Model.OuterEnumIntegerDefaultValue, options) end end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/foo.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/foo.ex new file mode 100644 index 00000000000..d73897b40ec --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/foo.ex @@ -0,0 +1,25 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Model.Foo do + @moduledoc """ + + """ + + @derive [Poison.Encoder] + defstruct [ + :"bar" + ] + + @type t :: %__MODULE__{ + :"bar" => String.t | nil + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.Foo do + def decode(value, _options) do + value + end +end + diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex index 170a43ba194..5c7e4a64290 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/format_test.ex @@ -15,6 +15,7 @@ defmodule OpenapiPetstore.Model.FormatTest do :"number", :"float", :"double", + :"decimal", :"string", :"byte", :"binary", @@ -22,7 +23,8 @@ defmodule OpenapiPetstore.Model.FormatTest do :"dateTime", :"uuid", :"password", - :"BigDecimal" + :"pattern_with_digits", + :"pattern_with_digits_and_delimiter" ] @type t :: %__MODULE__{ @@ -32,6 +34,7 @@ defmodule OpenapiPetstore.Model.FormatTest do :"number" => float(), :"float" => float() | nil, :"double" => float() | nil, + :"decimal" => String.t | nil, :"string" => String.t | nil, :"byte" => binary(), :"binary" => String.t | nil, @@ -39,7 +42,8 @@ defmodule OpenapiPetstore.Model.FormatTest do :"dateTime" => DateTime.t | nil, :"uuid" => String.t | nil, :"password" => String.t, - :"BigDecimal" => String.t | nil + :"pattern_with_digits" => String.t | nil, + :"pattern_with_digits_and_delimiter" => String.t | nil } end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/health_check_result.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/health_check_result.ex new file mode 100644 index 00000000000..269dc67b7db --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/health_check_result.ex @@ -0,0 +1,25 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Model.HealthCheckResult do + @moduledoc """ + Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + """ + + @derive [Poison.Encoder] + defstruct [ + :"NullableMessage" + ] + + @type t :: %__MODULE__{ + :"NullableMessage" => String.t | nil + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.HealthCheckResult do + def decode(value, _options) do + value + end +end + diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/inline_response_default.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/inline_response_default.ex new file mode 100644 index 00000000000..0bc779e9519 --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/inline_response_default.ex @@ -0,0 +1,27 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Model.InlineResponseDefault do + @moduledoc """ + + """ + + @derive [Poison.Encoder] + defstruct [ + :"string" + ] + + @type t :: %__MODULE__{ + :"string" => OpenapiPetstore.Model.Foo.t | nil + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.InlineResponseDefault do + import OpenapiPetstore.Deserializer + def decode(value, options) do + value + |> deserialize(:"string", :struct, OpenapiPetstore.Model.Foo, options) + end +end + diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex new file mode 100644 index 00000000000..7fcdc03ddc5 --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex @@ -0,0 +1,49 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Model.NullableClass do + @moduledoc """ + + """ + + @derive [Poison.Encoder] + defstruct [ + :"integer_prop", + :"number_prop", + :"boolean_prop", + :"string_prop", + :"date_prop", + :"datetime_prop", + :"array_nullable_prop", + :"array_and_items_nullable_prop", + :"array_items_nullable", + :"object_nullable_prop", + :"object_and_items_nullable_prop", + :"object_items_nullable" + ] + + @type t :: %__MODULE__{ + :"integer_prop" => integer() | nil, + :"number_prop" => float() | nil, + :"boolean_prop" => boolean() | nil, + :"string_prop" => String.t | nil, + :"date_prop" => Date.t | nil, + :"datetime_prop" => DateTime.t | nil, + :"array_nullable_prop" => [map()] | nil, + :"array_and_items_nullable_prop" => [map()] | nil, + :"array_items_nullable" => [map()] | nil, + :"object_nullable_prop" => %{optional(String.t) => map()} | nil, + :"object_and_items_nullable_prop" => %{optional(String.t) => map()} | nil, + :"object_items_nullable" => %{optional(String.t) => map()} | nil + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.NullableClass do + import OpenapiPetstore.Deserializer + def decode(value, options) do + value + |> deserialize(:"date_prop", :date, nil, options) + end +end + diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_default_value.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_default_value.ex new file mode 100644 index 00000000000..8c890fef506 --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_default_value.ex @@ -0,0 +1,25 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Model.OuterEnumDefaultValue do + @moduledoc """ + + """ + + @derive [Poison.Encoder] + defstruct [ + + ] + + @type t :: %__MODULE__{ + + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.OuterEnumDefaultValue do + def decode(value, _options) do + value + end +end + diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer.ex new file mode 100644 index 00000000000..5130ca77d21 --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer.ex @@ -0,0 +1,25 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Model.OuterEnumInteger do + @moduledoc """ + + """ + + @derive [Poison.Encoder] + defstruct [ + + ] + + @type t :: %__MODULE__{ + + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.OuterEnumInteger do + def decode(value, _options) do + value + end +end + diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer_default_value.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer_default_value.ex new file mode 100644 index 00000000000..33160c16795 --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_enum_integer_default_value.ex @@ -0,0 +1,25 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Model.OuterEnumIntegerDefaultValue do + @moduledoc """ + + """ + + @derive [Poison.Encoder] + defstruct [ + + ] + + @type t :: %__MODULE__{ + + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.OuterEnumIntegerDefaultValue do + def decode(value, _options) do + value + end +end + diff --git a/samples/openapi3/client/petstore/python-legacy/docs/PetApi.md b/samples/openapi3/client/petstore/python-legacy/docs/PetApi.md index 186933485ee..0472f7c000a 100755 --- a/samples/openapi3/client/petstore/python-legacy/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python-legacy/docs/PetApi.md @@ -81,6 +81,7 @@ void (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| +**200** | Successful operation | - | **405** | Invalid input | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -153,6 +154,7 @@ void (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| +**200** | Successful operation | - | **400** | Invalid pet value | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -446,6 +448,7 @@ void (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| +**200** | Successful operation | - | **400** | Invalid ID supplied | - | **404** | Pet not found | - | **405** | Validation exception | - | @@ -522,6 +525,7 @@ void (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| +**200** | Successful operation | - | **405** | Invalid input | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/AnotherFakeApi.java index c3b6939b7e7..8f7d9a631ce 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -60,8 +60,9 @@ public class AnotherFakeApi { @Consumes({ "application/json" }) @Produces({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response call123testSpecialTags(@ApiParam(value = "client model", required = true) @NotNull @Valid Client body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.call123testSpecialTags(body, securityContext); diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeApi.java index c1790615497..7f54c488ad1 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeApi.java @@ -70,8 +70,9 @@ public class FakeApi { @Consumes({ "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" }) @io.swagger.annotations.ApiOperation(value = "creates an XmlItem", notes = "this route creates an XmlItem", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createXmlItem(@ApiParam(value = "XmlItem Body", required = true) @NotNull @Valid XmlItem xmlItem,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createXmlItem(xmlItem, securityContext); @@ -81,8 +82,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) + }) public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body") Boolean body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterBooleanSerialize(body, securityContext); @@ -92,8 +94,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) + }) public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body") @Valid OuterComposite body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterCompositeSerialize(body, securityContext); @@ -103,8 +106,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) + }) public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body") BigDecimal body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterNumberSerialize(body, securityContext); @@ -114,8 +118,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) + }) public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body") String body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterStringSerialize(body, securityContext); @@ -125,8 +130,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testBodyWithFileSchema(@ApiParam(value = "", required = true) @NotNull @Valid FileSchemaTestClass body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithFileSchema(body, securityContext); @@ -136,8 +142,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testBodyWithQueryParams(@ApiParam(value = "", required = true) @QueryParam("query") @NotNull String query,@ApiParam(value = "", required = true) @NotNull @Valid User body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithQueryParams(query, body, securityContext); @@ -147,8 +154,9 @@ public class FakeApi { @Consumes({ "application/json" }) @Produces({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response testClientModel(@ApiParam(value = "client model", required = true) @NotNull @Valid Client body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClientModel(body, securityContext); @@ -160,10 +168,10 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", response = Void.class, authorizations = { @io.swagger.annotations.Authorization(value = "http_basic_test") }, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response testEndpointParameters(@ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number,@ApiParam(value = "None", required=true) @FormParam("double") Double _double,@ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte,@ApiParam(value = "None") @FormParam("integer") Integer integer,@ApiParam(value = "None") @FormParam("int32") Integer int32,@ApiParam(value = "None") @FormParam("int64") Long int64,@ApiParam(value = "None") @FormParam("float") Float _float,@ApiParam(value = "None") @FormParam("string") String string, @FormDataParam("binary") FormDataBodyPart binaryBodypart ,@ApiParam(value = "None") @FormParam("date") LocalDate date,@ApiParam(value = "None") @FormParam("dateTime") OffsetDateTime dateTime,@ApiParam(value = "None") @FormParam("password") String password,@ApiParam(value = "None") @FormParam("callback") String paramCallback,@Context SecurityContext securityContext) throws NotFoundException { @@ -174,10 +182,10 @@ public class FakeApi { @Consumes({ "application/x-www-form-urlencoded" }) @io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) + }) public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<>()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue = "-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $", defaultValue="$") @DefaultValue("$") @FormParam("enum_form_string_array") List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @FormParam("enum_form_string") String enumFormString,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, securityContext); @@ -187,8 +195,9 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "Fake endpoint to test group parameters (optional)", notes = "Fake endpoint to test group parameters (optional)", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Someting wrong", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Someting wrong", response = Void.class) + }) public Response testGroupParameters(@ApiParam(value = "Required String in group parameters", required = true) @QueryParam("required_string_group") @NotNull Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true)@HeaderParam("required_boolean_group") Boolean requiredBooleanGroup,@ApiParam(value = "Required Integer in group parameters", required = true) @QueryParam("required_int64_group") @NotNull Long requiredInt64Group,@ApiParam(value = "String in group parameters") @QueryParam("string_group") Integer stringGroup,@ApiParam(value = "Boolean in group parameters" )@HeaderParam("boolean_group") Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @QueryParam("int64_group") Long int64Group,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, securityContext); @@ -198,8 +207,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response testInlineAdditionalProperties(@ApiParam(value = "request body", required = true) @NotNull @Valid Map param,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testInlineAdditionalProperties(param, securityContext); @@ -209,8 +219,9 @@ public class FakeApi { @Consumes({ "application/x-www-form-urlencoded" }) @io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response testJsonFormData(@ApiParam(value = "field1", required=true) @FormParam("param") String param,@ApiParam(value = "field2", required=true) @FormParam("param2") String param2,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testJsonFormData(param, param2, securityContext); @@ -220,8 +231,9 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "To test the collection format in query parameters", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testQueryParameterCollectionFormat(@ApiParam(value = "", required = true) @QueryParam("pipe") @NotNull @Valid List pipe,@ApiParam(value = "", required = true) @QueryParam("ioutil") @NotNull @Valid List ioutil,@ApiParam(value = "", required = true) @QueryParam("http") @NotNull @Valid List http,@ApiParam(value = "", required = true) @QueryParam("url") @NotNull @Valid List url,@ApiParam(value = "", required = true) @QueryParam("context") @NotNull @Valid List context,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, securityContext); @@ -236,8 +248,9 @@ public class FakeApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) + }) public Response uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId, @FormDataParam("requiredFile") FormDataBodyPart requiredFileBodypart ,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata,@Context SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java index d0b9ebe7ab7..cb2aa18bb80 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -62,8 +62,9 @@ public class FakeClassnameTestApi { @io.swagger.annotations.ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", response = Client.class, authorizations = { @io.swagger.annotations.Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response testClassname(@ApiParam(value = "client model", required = true) @NotNull @Valid Client body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClassname(body, securityContext); diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/PetApi.java index 22e390d6d75..a31dd8b4083 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/PetApi.java @@ -68,10 +68,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) + }) public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.addPet(body, securityContext); @@ -86,10 +86,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) + }) public Response deletePet(@ApiParam(value = "Pet id to delete", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deletePet(petId, apiKey, securityContext); @@ -104,10 +104,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) + }) public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @QueryParam("status") @NotNull @Valid List status,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByStatus(status, securityContext); @@ -122,10 +122,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "Set"), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) + }) public Response findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @QueryParam("tags") @NotNull @Valid Set tags,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByTags(tags, securityContext); @@ -137,12 +137,11 @@ public class PetApi { @io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @io.swagger.annotations.Authorization(value = "api_key") }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) + }) public Response getPetById(@ApiParam(value = "ID of pet to return", required = true) @PathParam("petId") @NotNull Long petId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getPetById(petId, securityContext); @@ -157,14 +156,12 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) + }) public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePet(body, securityContext); @@ -179,8 +176,9 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) + }) public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePetWithForm(petId, name, status, securityContext); @@ -195,8 +193,9 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) + }) public Response uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata, @FormDataParam("file") FormDataBodyPart fileBodypart ,@Context SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/StoreApi.java index 11a88fa9459..39fbe7fb874 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/StoreApi.java @@ -61,10 +61,10 @@ public class StoreApi { @io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) + }) public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required = true) @PathParam("order_id") @NotNull String orderId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deleteOrder(orderId, securityContext); @@ -76,8 +76,9 @@ public class StoreApi { @io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @io.swagger.annotations.Authorization(value = "api_key") }, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") + }) public Response getInventory(@Context SecurityContext securityContext) throws NotFoundException { return delegate.getInventory(securityContext); @@ -87,12 +88,11 @@ public class StoreApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) + }) public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathParam("order_id") @NotNull @Min(1L) @Max(5L) Long orderId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getOrderById(orderId, securityContext); @@ -102,10 +102,10 @@ public class StoreApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) + }) public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet", required = true) @NotNull @Valid Order body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.placeOrder(body, securityContext); diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java index 8f8e8f72c01..36cc9df40f1 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java @@ -61,8 +61,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUser(@ApiParam(value = "Created user object", required = true) @NotNull @Valid User body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUser(body, securityContext); @@ -72,8 +73,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUsersWithArrayInput(@ApiParam(value = "List of user object", required = true) @NotNull @Valid List body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithArrayInput(body, securityContext); @@ -83,8 +85,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUsersWithListInput(@ApiParam(value = "List of user object", required = true) @NotNull @Valid List body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithListInput(body, securityContext); @@ -94,10 +97,10 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response deleteUser(@ApiParam(value = "The name that needs to be deleted", required = true) @PathParam("username") @NotNull String username,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deleteUser(username, securityContext); @@ -107,12 +110,11 @@ public class UserApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = User.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathParam("username") @NotNull String username,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getUserByName(username, securityContext); @@ -122,10 +124,10 @@ public class UserApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) + }) public Response loginUser(@ApiParam(value = "The user name for login", required = true) @QueryParam("username") @NotNull String username,@ApiParam(value = "The password for login in clear text", required = true) @QueryParam("password") @NotNull String password,@Context SecurityContext securityContext) throws NotFoundException { return delegate.loginUser(username, password, securityContext); @@ -135,8 +137,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response logoutUser(@Context SecurityContext securityContext) throws NotFoundException { return delegate.logoutUser(securityContext); @@ -146,10 +149,10 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response updateUser(@ApiParam(value = "name that need to be deleted", required = true) @PathParam("username") @NotNull String username,@ApiParam(value = "Updated user object", required = true) @NotNull @Valid User body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updateUser(username, body, securityContext); diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/AnotherFakeApi.java index df37d6838b2..107c2ff4dab 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -60,8 +60,9 @@ public class AnotherFakeApi { @Consumes({ "application/json" }) @Produces({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response call123testSpecialTags(@ApiParam(value = "client model", required = true) @NotNull @Valid Client client,@Context SecurityContext securityContext) throws NotFoundException { return delegate.call123testSpecialTags(client, securityContext); diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java index e3e8e029a2d..3ce42cd81fb 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java @@ -70,8 +70,9 @@ public class FakeApi { @Produces({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "Health check endpoint", notes = "", response = HealthCheckResult.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "The instance started successfully", response = HealthCheckResult.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "The instance started successfully", response = HealthCheckResult.class) + }) public Response fakeHealthGet(@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeHealthGet(securityContext); @@ -83,8 +84,9 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "test http signature authentication", notes = "", response = Void.class, authorizations = { @io.swagger.annotations.Authorization(value = "http_signature_test") }, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "The instance started successfully", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "The instance started successfully", response = Void.class) + }) public Response fakeHttpSignatureTest(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@ApiParam(value = "query parameter") @QueryParam("query_1") String query1,@ApiParam(value = "header parameter" )@HeaderParam("header_1") String header1,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeHttpSignatureTest(pet, query1, header1, securityContext); @@ -94,8 +96,9 @@ public class FakeApi { @Consumes({ "application/json" }) @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) + }) public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body") Boolean body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterBooleanSerialize(body, securityContext); @@ -105,8 +108,9 @@ public class FakeApi { @Consumes({ "application/json" }) @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) + }) public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body") @Valid OuterComposite outerComposite,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterCompositeSerialize(outerComposite, securityContext); @@ -116,8 +120,9 @@ public class FakeApi { @Consumes({ "application/json" }) @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) + }) public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body") BigDecimal body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterNumberSerialize(body, securityContext); @@ -127,8 +132,9 @@ public class FakeApi { @Consumes({ "application/json" }) @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) + }) public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body") String body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterStringSerialize(body, securityContext); @@ -138,8 +144,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testBodyWithFileSchema(@ApiParam(value = "", required = true) @NotNull @Valid FileSchemaTestClass fileSchemaTestClass,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithFileSchema(fileSchemaTestClass, securityContext); @@ -149,8 +156,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testBodyWithQueryParams(@ApiParam(value = "", required = true) @QueryParam("query") @NotNull String query,@ApiParam(value = "", required = true) @NotNull @Valid User user,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithQueryParams(query, user, securityContext); @@ -160,8 +168,9 @@ public class FakeApi { @Consumes({ "application/json" }) @Produces({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response testClientModel(@ApiParam(value = "client model", required = true) @NotNull @Valid Client client,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClientModel(client, securityContext); @@ -173,10 +182,10 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @io.swagger.annotations.Authorization(value = "http_basic_test") }, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response testEndpointParameters(@ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number,@ApiParam(value = "None", required=true) @FormParam("double") Double _double,@ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte,@ApiParam(value = "None") @FormParam("integer") Integer integer,@ApiParam(value = "None") @FormParam("int32") Integer int32,@ApiParam(value = "None") @FormParam("int64") Long int64,@ApiParam(value = "None") @FormParam("float") Float _float,@ApiParam(value = "None") @FormParam("string") String string, @FormDataParam("binary") FormDataBodyPart binaryBodypart ,@ApiParam(value = "None") @FormParam("date") Date date,@ApiParam(value = "None") @FormParam("dateTime") Date dateTime,@ApiParam(value = "None") @FormParam("password") String password,@ApiParam(value = "None") @FormParam("callback") String paramCallback,@Context SecurityContext securityContext) throws NotFoundException { @@ -187,10 +196,10 @@ public class FakeApi { @Consumes({ "application/x-www-form-urlencoded" }) @io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) + }) public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue = "-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $", defaultValue="$") @DefaultValue("$") @FormParam("enum_form_string_array") List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @FormParam("enum_form_string") String enumFormString,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, securityContext); @@ -202,8 +211,9 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "Fake endpoint to test group parameters (optional)", notes = "Fake endpoint to test group parameters (optional)", response = Void.class, authorizations = { @io.swagger.annotations.Authorization(value = "bearer_test") }, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Someting wrong", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Someting wrong", response = Void.class) + }) public Response testGroupParameters(@ApiParam(value = "Required String in group parameters", required = true) @QueryParam("required_string_group") @NotNull Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true)@HeaderParam("required_boolean_group") Boolean requiredBooleanGroup,@ApiParam(value = "Required Integer in group parameters", required = true) @QueryParam("required_int64_group") @NotNull Long requiredInt64Group,@ApiParam(value = "String in group parameters") @QueryParam("string_group") Integer stringGroup,@ApiParam(value = "Boolean in group parameters" )@HeaderParam("boolean_group") Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @QueryParam("int64_group") Long int64Group,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, securityContext); @@ -213,8 +223,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response testInlineAdditionalProperties(@ApiParam(value = "request body", required = true) @NotNull @Valid Map requestBody,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testInlineAdditionalProperties(requestBody, securityContext); @@ -224,8 +235,9 @@ public class FakeApi { @Consumes({ "application/x-www-form-urlencoded" }) @io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response testJsonFormData(@ApiParam(value = "field1", required=true) @FormParam("param") String param,@ApiParam(value = "field2", required=true) @FormParam("param2") String param2,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testJsonFormData(param, param2, securityContext); @@ -235,8 +247,9 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "To test the collection format in query parameters", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testQueryParameterCollectionFormat(@ApiParam(value = "", required = true) @QueryParam("pipe") @NotNull @Valid List pipe,@ApiParam(value = "", required = true) @QueryParam("ioutil") @NotNull @Valid List ioutil,@ApiParam(value = "", required = true) @QueryParam("http") @NotNull @Valid List http,@ApiParam(value = "", required = true) @QueryParam("url") @NotNull @Valid List url,@ApiParam(value = "", required = true) @QueryParam("context") @NotNull @Valid List context,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, securityContext); @@ -251,8 +264,9 @@ public class FakeApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) + }) public Response uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId, @FormDataParam("requiredFile") FormDataBodyPart requiredFileBodypart ,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata,@Context SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java index d0c2ed09e19..610cdf10541 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -62,8 +62,9 @@ public class FakeClassnameTestApi { @io.swagger.annotations.ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", response = Client.class, authorizations = { @io.swagger.annotations.Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response testClassname(@ApiParam(value = "client model", required = true) @NotNull @Valid Client client,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClassname(client, securityContext); diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java index b8c8acf12a9..c03c94e18f2 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java @@ -60,8 +60,9 @@ public class FooApi { @Produces({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "", notes = "", response = InlineResponseDefault.class, tags={ }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "response", response = InlineResponseDefault.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "response", response = InlineResponseDefault.class) + }) public Response fooGet(@Context SecurityContext securityContext) throws NotFoundException { return delegate.fooGet(securityContext); diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java index e4e091bf1d8..498a5e0d55a 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java @@ -67,8 +67,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Successful operation", response = Void.class), + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) + }) public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext) throws NotFoundException { return delegate.addPet(pet, securityContext); @@ -83,8 +85,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Successful operation", response = Void.class), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) + }) public Response deletePet(@ApiParam(value = "Pet id to delete", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deletePet(petId, apiKey, securityContext); @@ -99,10 +103,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) + }) public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @QueryParam("status") @NotNull @Valid List status,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByStatus(status, securityContext); @@ -117,10 +121,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) + }) public Response findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @QueryParam("tags") @NotNull @Valid List tags,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByTags(tags, securityContext); @@ -132,12 +136,11 @@ public class PetApi { @io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @io.swagger.annotations.Authorization(value = "api_key") }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) + }) public Response getPetById(@ApiParam(value = "ID of pet to return", required = true) @PathParam("petId") @NotNull Long petId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getPetById(petId, securityContext); @@ -152,12 +155,12 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Successful operation", response = Void.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) + }) public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePet(pet, securityContext); @@ -172,8 +175,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Successful operation", response = Void.class), + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) + }) public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePetWithForm(petId, name, status, securityContext); @@ -188,8 +193,9 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) + }) public Response uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata, @FormDataParam("file") FormDataBodyPart fileBodypart ,@Context SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java index 8b8feaa5aa3..59e5838348c 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java @@ -61,10 +61,10 @@ public class StoreApi { @io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) + }) public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required = true) @PathParam("order_id") @NotNull String orderId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deleteOrder(orderId, securityContext); @@ -76,8 +76,9 @@ public class StoreApi { @io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @io.swagger.annotations.Authorization(value = "api_key") }, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") + }) public Response getInventory(@Context SecurityContext securityContext) throws NotFoundException { return delegate.getInventory(securityContext); @@ -87,12 +88,11 @@ public class StoreApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) + }) public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathParam("order_id") @NotNull @Min(1L) @Max(5L) Long orderId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getOrderById(orderId, securityContext); @@ -102,10 +102,10 @@ public class StoreApi { @Consumes({ "application/json" }) @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) + }) public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet", required = true) @NotNull @Valid Order order,@Context SecurityContext securityContext) throws NotFoundException { return delegate.placeOrder(order, securityContext); diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java index bd4006d8d8c..e394533a252 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java @@ -61,8 +61,9 @@ public class UserApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUser(@ApiParam(value = "Created user object", required = true) @NotNull @Valid User user,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUser(user, securityContext); @@ -72,8 +73,9 @@ public class UserApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUsersWithArrayInput(@ApiParam(value = "List of user object", required = true) @NotNull @Valid List user,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithArrayInput(user, securityContext); @@ -83,8 +85,9 @@ public class UserApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUsersWithListInput(@ApiParam(value = "List of user object", required = true) @NotNull @Valid List user,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithListInput(user, securityContext); @@ -94,10 +97,10 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response deleteUser(@ApiParam(value = "The name that needs to be deleted", required = true) @PathParam("username") @NotNull String username,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deleteUser(username, securityContext); @@ -107,12 +110,11 @@ public class UserApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = User.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathParam("username") @NotNull String username,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getUserByName(username, securityContext); @@ -122,10 +124,10 @@ public class UserApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) + }) public Response loginUser(@ApiParam(value = "The user name for login", required = true) @QueryParam("username") @NotNull String username,@ApiParam(value = "The password for login in clear text", required = true) @QueryParam("password") @NotNull String password,@Context SecurityContext securityContext) throws NotFoundException { return delegate.loginUser(username, password, securityContext); @@ -135,8 +137,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response logoutUser(@Context SecurityContext securityContext) throws NotFoundException { return delegate.logoutUser(securityContext); @@ -146,10 +149,10 @@ public class UserApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response updateUser(@ApiParam(value = "name that need to be deleted", required = true) @PathParam("username") @NotNull String username,@ApiParam(value = "Updated user object", required = true) @NotNull @Valid User user,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updateUser(username, user, securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java index 828b1a21e67..e2e969716b3 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -60,8 +60,9 @@ public class AnotherFakeApi { @Consumes({ "application/json" }) @Produces({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response call123testSpecialTags(@ApiParam(value = "client model", required = true) @NotNull @Valid Client body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.call123testSpecialTags(body, securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeApi.java index 1db92cafd33..80dee9b4398 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeApi.java @@ -68,8 +68,9 @@ public class FakeApi { @Consumes({ "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" }) @io.swagger.annotations.ApiOperation(value = "creates an XmlItem", notes = "this route creates an XmlItem", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createXmlItem(@ApiParam(value = "XmlItem Body", required = true) @NotNull @Valid XmlItem xmlItem,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createXmlItem(xmlItem, securityContext); @@ -79,8 +80,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) + }) public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body") Boolean body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterBooleanSerialize(body, securityContext); @@ -90,8 +92,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) + }) public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body") @Valid OuterComposite body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterCompositeSerialize(body, securityContext); @@ -101,8 +104,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) + }) public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body") BigDecimal body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterNumberSerialize(body, securityContext); @@ -112,8 +116,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) + }) public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body") String body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterStringSerialize(body, securityContext); @@ -123,8 +128,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testBodyWithFileSchema(@ApiParam(value = "", required = true) @NotNull @Valid FileSchemaTestClass body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithFileSchema(body, securityContext); @@ -134,8 +140,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testBodyWithQueryParams(@ApiParam(value = "", required = true) @QueryParam("query") @NotNull String query,@ApiParam(value = "", required = true) @NotNull @Valid User body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithQueryParams(query, body, securityContext); @@ -145,8 +152,9 @@ public class FakeApi { @Consumes({ "application/json" }) @Produces({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response testClientModel(@ApiParam(value = "client model", required = true) @NotNull @Valid Client body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClientModel(body, securityContext); @@ -158,10 +166,10 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", response = Void.class, authorizations = { @io.swagger.annotations.Authorization(value = "http_basic_test") }, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response testEndpointParameters(@ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number,@ApiParam(value = "None", required=true) @FormParam("double") Double _double,@ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte,@ApiParam(value = "None") @FormParam("integer") Integer integer,@ApiParam(value = "None") @FormParam("int32") Integer int32,@ApiParam(value = "None") @FormParam("int64") Long int64,@ApiParam(value = "None") @FormParam("float") Float _float,@ApiParam(value = "None") @FormParam("string") String string, @FormDataParam("binary") FormDataBodyPart binaryBodypart ,@ApiParam(value = "None") @FormParam("date") Date date,@ApiParam(value = "None") @FormParam("dateTime") Date dateTime,@ApiParam(value = "None") @FormParam("password") String password,@ApiParam(value = "None") @FormParam("callback") String paramCallback,@Context SecurityContext securityContext) throws NotFoundException { @@ -172,10 +180,10 @@ public class FakeApi { @Consumes({ "application/x-www-form-urlencoded" }) @io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) + }) public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue = "-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $", defaultValue="$") @DefaultValue("$") @FormParam("enum_form_string_array") List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @FormParam("enum_form_string") String enumFormString,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, securityContext); @@ -185,8 +193,9 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "Fake endpoint to test group parameters (optional)", notes = "Fake endpoint to test group parameters (optional)", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Someting wrong", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Someting wrong", response = Void.class) + }) public Response testGroupParameters(@ApiParam(value = "Required String in group parameters", required = true) @QueryParam("required_string_group") @NotNull Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true)@HeaderParam("required_boolean_group") Boolean requiredBooleanGroup,@ApiParam(value = "Required Integer in group parameters", required = true) @QueryParam("required_int64_group") @NotNull Long requiredInt64Group,@ApiParam(value = "String in group parameters") @QueryParam("string_group") Integer stringGroup,@ApiParam(value = "Boolean in group parameters" )@HeaderParam("boolean_group") Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @QueryParam("int64_group") Long int64Group,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, securityContext); @@ -196,8 +205,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response testInlineAdditionalProperties(@ApiParam(value = "request body", required = true) @NotNull @Valid Map param,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testInlineAdditionalProperties(param, securityContext); @@ -207,8 +217,9 @@ public class FakeApi { @Consumes({ "application/x-www-form-urlencoded" }) @io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response testJsonFormData(@ApiParam(value = "field1", required=true) @FormParam("param") String param,@ApiParam(value = "field2", required=true) @FormParam("param2") String param2,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testJsonFormData(param, param2, securityContext); @@ -218,8 +229,9 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "To test the collection format in query parameters", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testQueryParameterCollectionFormat(@ApiParam(value = "", required = true) @QueryParam("pipe") @NotNull @Valid List pipe,@ApiParam(value = "", required = true) @QueryParam("ioutil") @NotNull @Valid List ioutil,@ApiParam(value = "", required = true) @QueryParam("http") @NotNull @Valid List http,@ApiParam(value = "", required = true) @QueryParam("url") @NotNull @Valid List url,@ApiParam(value = "", required = true) @QueryParam("context") @NotNull @Valid List context,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java index 7576189e356..a7cb2eb4f9c 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java @@ -62,8 +62,9 @@ public class FakeClassnameTags123Api { @io.swagger.annotations.ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", response = Client.class, authorizations = { @io.swagger.annotations.Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response testClassname(@ApiParam(value = "client model", required = true) @NotNull @Valid Client body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClassname(body, securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/PetApi.java index 1f5fd171a90..34a10fd7595 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/PetApi.java @@ -68,10 +68,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) + }) public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.addPet(body, securityContext); @@ -86,10 +86,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) + }) public Response deletePet(@ApiParam(value = "Pet id to delete", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deletePet(petId, apiKey, securityContext); @@ -104,10 +104,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) + }) public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @QueryParam("status") @NotNull @Valid List status,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByStatus(status, securityContext); @@ -122,10 +122,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "Set"), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) + }) public Response findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @QueryParam("tags") @NotNull @Valid Set tags,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByTags(tags, securityContext); @@ -137,12 +137,11 @@ public class PetApi { @io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @io.swagger.annotations.Authorization(value = "api_key") }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) + }) public Response getPetById(@ApiParam(value = "ID of pet to return", required = true) @PathParam("petId") @NotNull Long petId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getPetById(petId, securityContext); @@ -157,14 +156,12 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) + }) public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePet(body, securityContext); @@ -179,8 +176,9 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) + }) public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePetWithForm(petId, name, status, securityContext); @@ -195,8 +193,9 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) + }) public Response uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata, @FormDataParam("file") FormDataBodyPart fileBodypart ,@Context SecurityContext securityContext) throws NotFoundException { @@ -212,8 +211,9 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) + }) public Response uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId, @FormDataParam("requiredFile") FormDataBodyPart requiredFileBodypart ,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata,@Context SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/StoreApi.java index 3f9f55d4acc..717f813e51f 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/StoreApi.java @@ -61,10 +61,10 @@ public class StoreApi { @io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) + }) public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required = true) @PathParam("order_id") @NotNull String orderId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deleteOrder(orderId, securityContext); @@ -76,8 +76,9 @@ public class StoreApi { @io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @io.swagger.annotations.Authorization(value = "api_key") }, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") + }) public Response getInventory(@Context SecurityContext securityContext) throws NotFoundException { return delegate.getInventory(securityContext); @@ -87,12 +88,11 @@ public class StoreApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) + }) public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathParam("order_id") @NotNull @Min(1L) @Max(5L) Long orderId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getOrderById(orderId, securityContext); @@ -102,10 +102,10 @@ public class StoreApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) + }) public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet", required = true) @NotNull @Valid Order body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.placeOrder(body, securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java index 7ad517e4c0d..18cbe2d5c3b 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java @@ -61,8 +61,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUser(@ApiParam(value = "Created user object", required = true) @NotNull @Valid User body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUser(body, securityContext); @@ -72,8 +73,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUsersWithArrayInput(@ApiParam(value = "List of user object", required = true) @NotNull @Valid List body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithArrayInput(body, securityContext); @@ -83,8 +85,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUsersWithListInput(@ApiParam(value = "List of user object", required = true) @NotNull @Valid List body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithListInput(body, securityContext); @@ -94,10 +97,10 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response deleteUser(@ApiParam(value = "The name that needs to be deleted", required = true) @PathParam("username") @NotNull String username,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deleteUser(username, securityContext); @@ -107,12 +110,11 @@ public class UserApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = User.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathParam("username") @NotNull String username,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getUserByName(username, securityContext); @@ -122,10 +124,10 @@ public class UserApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) + }) public Response loginUser(@ApiParam(value = "The user name for login", required = true) @QueryParam("username") @NotNull String username,@ApiParam(value = "The password for login in clear text", required = true) @QueryParam("password") @NotNull String password,@Context SecurityContext securityContext) throws NotFoundException { return delegate.loginUser(username, password, securityContext); @@ -135,8 +137,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response logoutUser(@Context SecurityContext securityContext) throws NotFoundException { return delegate.logoutUser(securityContext); @@ -146,10 +149,10 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response updateUser(@ApiParam(value = "name that need to be deleted", required = true) @PathParam("username") @NotNull String username,@ApiParam(value = "Updated user object", required = true) @NotNull @Valid User body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updateUser(username, body, securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/AnotherFakeApi.java index c3b6939b7e7..8f7d9a631ce 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -60,8 +60,9 @@ public class AnotherFakeApi { @Consumes({ "application/json" }) @Produces({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response call123testSpecialTags(@ApiParam(value = "client model", required = true) @NotNull @Valid Client body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.call123testSpecialTags(body, securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeApi.java index 847f76099f9..f6fee9c47f9 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeApi.java @@ -69,8 +69,9 @@ public class FakeApi { @Consumes({ "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" }) @io.swagger.annotations.ApiOperation(value = "creates an XmlItem", notes = "this route creates an XmlItem", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createXmlItem(@ApiParam(value = "XmlItem Body", required = true) @NotNull @Valid XmlItem xmlItem,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createXmlItem(xmlItem, securityContext); @@ -80,8 +81,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) + }) public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body") Boolean body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterBooleanSerialize(body, securityContext); @@ -91,8 +93,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) + }) public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body") @Valid OuterComposite body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterCompositeSerialize(body, securityContext); @@ -102,8 +105,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) + }) public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body") BigDecimal body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterNumberSerialize(body, securityContext); @@ -113,8 +117,9 @@ public class FakeApi { @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) + }) public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body") String body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterStringSerialize(body, securityContext); @@ -124,8 +129,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testBodyWithFileSchema(@ApiParam(value = "", required = true) @NotNull @Valid FileSchemaTestClass body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithFileSchema(body, securityContext); @@ -135,8 +141,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testBodyWithQueryParams(@ApiParam(value = "", required = true) @QueryParam("query") @NotNull String query,@ApiParam(value = "", required = true) @NotNull @Valid User body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithQueryParams(query, body, securityContext); @@ -146,8 +153,9 @@ public class FakeApi { @Consumes({ "application/json" }) @Produces({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response testClientModel(@ApiParam(value = "client model", required = true) @NotNull @Valid Client body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClientModel(body, securityContext); @@ -159,10 +167,10 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", response = Void.class, authorizations = { @io.swagger.annotations.Authorization(value = "http_basic_test") }, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response testEndpointParameters(@ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number,@ApiParam(value = "None", required=true) @FormParam("double") Double _double,@ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte,@ApiParam(value = "None") @FormParam("integer") Integer integer,@ApiParam(value = "None") @FormParam("int32") Integer int32,@ApiParam(value = "None") @FormParam("int64") Long int64,@ApiParam(value = "None") @FormParam("float") Float _float,@ApiParam(value = "None") @FormParam("string") String string, @FormDataParam("binary") FormDataBodyPart binaryBodypart ,@ApiParam(value = "None") @FormParam("date") Date date,@ApiParam(value = "None") @FormParam("dateTime") Date dateTime,@ApiParam(value = "None") @FormParam("password") String password,@ApiParam(value = "None") @FormParam("callback") String paramCallback,@Context SecurityContext securityContext) throws NotFoundException { @@ -173,10 +181,10 @@ public class FakeApi { @Consumes({ "application/x-www-form-urlencoded" }) @io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) + }) public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue = "-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $", defaultValue="$") @DefaultValue("$") @FormParam("enum_form_string_array") List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @FormParam("enum_form_string") String enumFormString,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, securityContext); @@ -186,8 +194,9 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "Fake endpoint to test group parameters (optional)", notes = "Fake endpoint to test group parameters (optional)", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Someting wrong", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Someting wrong", response = Void.class) + }) public Response testGroupParameters(@ApiParam(value = "Required String in group parameters", required = true) @QueryParam("required_string_group") @NotNull Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true)@HeaderParam("required_boolean_group") Boolean requiredBooleanGroup,@ApiParam(value = "Required Integer in group parameters", required = true) @QueryParam("required_int64_group") @NotNull Long requiredInt64Group,@ApiParam(value = "String in group parameters") @QueryParam("string_group") Integer stringGroup,@ApiParam(value = "Boolean in group parameters" )@HeaderParam("boolean_group") Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @QueryParam("int64_group") Long int64Group,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, securityContext); @@ -197,8 +206,9 @@ public class FakeApi { @Consumes({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response testInlineAdditionalProperties(@ApiParam(value = "request body", required = true) @NotNull @Valid Map param,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testInlineAdditionalProperties(param, securityContext); @@ -208,8 +218,9 @@ public class FakeApi { @Consumes({ "application/x-www-form-urlencoded" }) @io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response testJsonFormData(@ApiParam(value = "field1", required=true) @FormParam("param") String param,@ApiParam(value = "field2", required=true) @FormParam("param2") String param2,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testJsonFormData(param, param2, securityContext); @@ -219,8 +230,9 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "To test the collection format in query parameters", response = Void.class, tags={ "fake", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) + }) public Response testQueryParameterCollectionFormat(@ApiParam(value = "", required = true) @QueryParam("pipe") @NotNull @Valid List pipe,@ApiParam(value = "", required = true) @QueryParam("ioutil") @NotNull @Valid List ioutil,@ApiParam(value = "", required = true) @QueryParam("http") @NotNull @Valid List http,@ApiParam(value = "", required = true) @QueryParam("url") @NotNull @Valid List url,@ApiParam(value = "", required = true) @QueryParam("context") @NotNull @Valid List context,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, securityContext); @@ -235,8 +247,9 @@ public class FakeApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) + }) public Response uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId, @FormDataParam("requiredFile") FormDataBodyPart requiredFileBodypart ,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata,@Context SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java index d0b9ebe7ab7..cb2aa18bb80 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -62,8 +62,9 @@ public class FakeClassnameTestApi { @io.swagger.annotations.ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", response = Client.class, authorizations = { @io.swagger.annotations.Authorization(value = "api_key_query") }, tags={ "fake_classname_tags 123#$%^", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) public Response testClassname(@ApiParam(value = "client model", required = true) @NotNull @Valid Client body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClassname(body, securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/PetApi.java index 22e390d6d75..a31dd8b4083 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/PetApi.java @@ -68,10 +68,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) + }) public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.addPet(body, securityContext); @@ -86,10 +86,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) + }) public Response deletePet(@ApiParam(value = "Pet id to delete", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deletePet(petId, apiKey, securityContext); @@ -104,10 +104,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) + }) public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @QueryParam("status") @NotNull @Valid List status,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByStatus(status, securityContext); @@ -122,10 +122,10 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "Set"), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) + }) public Response findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @QueryParam("tags") @NotNull @Valid Set tags,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByTags(tags, securityContext); @@ -137,12 +137,11 @@ public class PetApi { @io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @io.swagger.annotations.Authorization(value = "api_key") }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) + }) public Response getPetById(@ApiParam(value = "ID of pet to return", required = true) @PathParam("petId") @NotNull Long petId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getPetById(petId, securityContext); @@ -157,14 +156,12 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) + }) public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePet(body, securityContext); @@ -179,8 +176,9 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) + }) public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePetWithForm(petId, name, status, securityContext); @@ -195,8 +193,9 @@ public class PetApi { @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) + }) public Response uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata, @FormDataParam("file") FormDataBodyPart fileBodypart ,@Context SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/StoreApi.java index 11a88fa9459..39fbe7fb874 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/StoreApi.java @@ -61,10 +61,10 @@ public class StoreApi { @io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) + }) public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required = true) @PathParam("order_id") @NotNull String orderId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deleteOrder(orderId, securityContext); @@ -76,8 +76,9 @@ public class StoreApi { @io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @io.swagger.annotations.Authorization(value = "api_key") }, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") + }) public Response getInventory(@Context SecurityContext securityContext) throws NotFoundException { return delegate.getInventory(securityContext); @@ -87,12 +88,11 @@ public class StoreApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) + }) public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathParam("order_id") @NotNull @Min(1L) @Max(5L) Long orderId,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getOrderById(orderId, securityContext); @@ -102,10 +102,10 @@ public class StoreApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) + }) public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet", required = true) @NotNull @Valid Order body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.placeOrder(body, securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java index 8f8e8f72c01..36cc9df40f1 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java @@ -61,8 +61,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUser(@ApiParam(value = "Created user object", required = true) @NotNull @Valid User body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUser(body, securityContext); @@ -72,8 +73,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUsersWithArrayInput(@ApiParam(value = "List of user object", required = true) @NotNull @Valid List body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithArrayInput(body, securityContext); @@ -83,8 +85,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response createUsersWithListInput(@ApiParam(value = "List of user object", required = true) @NotNull @Valid List body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithListInput(body, securityContext); @@ -94,10 +97,10 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response deleteUser(@ApiParam(value = "The name that needs to be deleted", required = true) @PathParam("username") @NotNull String username,@Context SecurityContext securityContext) throws NotFoundException { return delegate.deleteUser(username, securityContext); @@ -107,12 +110,11 @@ public class UserApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = User.class), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathParam("username") @NotNull String username,@Context SecurityContext securityContext) throws NotFoundException { return delegate.getUserByName(username, securityContext); @@ -122,10 +124,10 @@ public class UserApi { @Produces({ "application/xml", "application/json" }) @io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class), - - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) + }) public Response loginUser(@ApiParam(value = "The user name for login", required = true) @QueryParam("username") @NotNull String username,@ApiParam(value = "The password for login in clear text", required = true) @QueryParam("password") @NotNull String password,@Context SecurityContext securityContext) throws NotFoundException { return delegate.loginUser(username, password, securityContext); @@ -135,8 +137,9 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) public Response logoutUser(@Context SecurityContext securityContext) throws NotFoundException { return delegate.logoutUser(securityContext); @@ -146,10 +149,10 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), - - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) + }) public Response updateUser(@ApiParam(value = "name that need to be deleted", required = true) @PathParam("username") @NotNull String username,@ApiParam(value = "Updated user object", required = true) @NotNull @Valid User body,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updateUser(username, body, securityContext); From f6019f00a1e6dba499850aa39cdc37af11aef3d3 Mon Sep 17 00:00:00 2001 From: Frank Lehmann <11268968+fl034@users.noreply.github.com> Date: Wed, 27 Jan 2021 04:17:42 +0100 Subject: [PATCH 48/54] [swift5] Fix #8511 (request closure not being called) (#8537) * Remove weak self to fix too early deallocations * Update samples * Remove podfile lock * Run pod install on samples/client/test/swift5/default/TestClientApp/ * Revert "Run pod install on samples/client/test/swift5/default/TestClientApp/" This reverts commit 5ad327c70789a6ab50e372a5bbc2cfa3b0a7f883. --- .../urlsession/URLSessionImplementations.mustache | 8 ++------ .../Classes/OpenAPIs/URLSessionImplementations.swift | 8 ++------ .../Classes/OpenAPIs/URLSessionImplementations.swift | 8 ++------ .../Classes/OpenAPIs/URLSessionImplementations.swift | 8 ++------ .../Classes/OpenAPIs/URLSessionImplementations.swift | 8 ++------ .../Classes/OpenAPIs/URLSessionImplementations.swift | 8 ++------ .../Classes/OpenAPIs/URLSessionImplementations.swift | 8 ++------ .../Classes/OpenAPIs/URLSessionImplementations.swift | 8 ++------ .../Classes/OpenAPIs/URLSessionImplementations.swift | 8 ++------ .../Classes/OpenAPIs/URLSessionImplementations.swift | 8 ++------ .../Classes/OpenAPIs/URLSessionImplementations.swift | 8 ++------ 11 files changed, 22 insertions(+), 66 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache index 896871b8d7e..95733f9d546 100644 --- a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache @@ -132,15 +132,11 @@ private var urlSessionStore = SynchronizedDictionary() do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - - guard let self = self else { return } + let dataTask = urlSession.dataTask(with: request) { data, response, error in if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - - guard let self = self else { return } + taskCompletionShouldRetry(data, response, error) { shouldRetry in if shouldRetry { cleanupRequest() diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index c7804d16e30..eda7e851c9e 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -132,15 +132,11 @@ open class URLSessionRequestBuilder: RequestBuilder { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - - guard let self = self else { return } + let dataTask = urlSession.dataTask(with: request) { data, response, error in if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - - guard let self = self else { return } + taskCompletionShouldRetry(data, response, error) { shouldRetry in if shouldRetry { cleanupRequest() diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index c7804d16e30..eda7e851c9e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -132,15 +132,11 @@ open class URLSessionRequestBuilder: RequestBuilder { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - - guard let self = self else { return } + let dataTask = urlSession.dataTask(with: request) { data, response, error in if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - - guard let self = self else { return } + taskCompletionShouldRetry(data, response, error) { shouldRetry in if shouldRetry { cleanupRequest() diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index c7804d16e30..eda7e851c9e 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -132,15 +132,11 @@ open class URLSessionRequestBuilder: RequestBuilder { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - - guard let self = self else { return } + let dataTask = urlSession.dataTask(with: request) { data, response, error in if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - - guard let self = self else { return } + taskCompletionShouldRetry(data, response, error) { shouldRetry in if shouldRetry { cleanupRequest() diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a2de4751c64..8e6e4d85ec3 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -132,15 +132,11 @@ internal class URLSessionRequestBuilder: RequestBuilder { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - - guard let self = self else { return } + let dataTask = urlSession.dataTask(with: request) { data, response, error in if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - - guard let self = self else { return } + taskCompletionShouldRetry(data, response, error) { shouldRetry in if shouldRetry { cleanupRequest() diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index c7804d16e30..eda7e851c9e 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -132,15 +132,11 @@ open class URLSessionRequestBuilder: RequestBuilder { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - - guard let self = self else { return } + let dataTask = urlSession.dataTask(with: request) { data, response, error in if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - - guard let self = self else { return } + taskCompletionShouldRetry(data, response, error) { shouldRetry in if shouldRetry { cleanupRequest() diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index c7804d16e30..eda7e851c9e 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -132,15 +132,11 @@ open class URLSessionRequestBuilder: RequestBuilder { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - - guard let self = self else { return } + let dataTask = urlSession.dataTask(with: request) { data, response, error in if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - - guard let self = self else { return } + taskCompletionShouldRetry(data, response, error) { shouldRetry in if shouldRetry { cleanupRequest() diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index c7804d16e30..eda7e851c9e 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -132,15 +132,11 @@ open class URLSessionRequestBuilder: RequestBuilder { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - - guard let self = self else { return } + let dataTask = urlSession.dataTask(with: request) { data, response, error in if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - - guard let self = self else { return } + taskCompletionShouldRetry(data, response, error) { shouldRetry in if shouldRetry { cleanupRequest() diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index c7804d16e30..eda7e851c9e 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -132,15 +132,11 @@ open class URLSessionRequestBuilder: RequestBuilder { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - - guard let self = self else { return } + let dataTask = urlSession.dataTask(with: request) { data, response, error in if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - - guard let self = self else { return } + taskCompletionShouldRetry(data, response, error) { shouldRetry in if shouldRetry { cleanupRequest() diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index c7804d16e30..eda7e851c9e 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -132,15 +132,11 @@ open class URLSessionRequestBuilder: RequestBuilder { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - - guard let self = self else { return } + let dataTask = urlSession.dataTask(with: request) { data, response, error in if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - - guard let self = self else { return } + taskCompletionShouldRetry(data, response, error) { shouldRetry in if shouldRetry { cleanupRequest() diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index c7804d16e30..eda7e851c9e 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -132,15 +132,11 @@ open class URLSessionRequestBuilder: RequestBuilder { do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - - guard let self = self else { return } + let dataTask = urlSession.dataTask(with: request) { data, response, error in if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - - guard let self = self else { return } + taskCompletionShouldRetry(data, response, error) { shouldRetry in if shouldRetry { cleanupRequest() From b203539869c2299acdbc94f2a6886b72d175a84a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 27 Jan 2021 13:19:59 +0800 Subject: [PATCH 49/54] update doc, move bitrise.yml (#8547) --- README.md | 6 ++++-- CI/bitrise.yml => bitrise.yml | 0 2 files changed, 4 insertions(+), 2 deletions(-) rename CI/bitrise.yml => bitrise.yml (100%) diff --git a/README.md b/README.md index c270088a292..90e9fdeaea8 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se | | Languages/Frameworks | | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0), **C++** (cpp-restsdk, Qt5, Tizen), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (rust, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 8.x), Aurelia, Axios, Fetch, Inversify, jQuery, Node, Rxjs) | +| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0), **C++** (cpp-restsdk, Qt5, Tizen), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (rust, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 8.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, Rxjs) | | **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) | | **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc** | | **Configuration files** | [**Apache2**](https://httpd.apache.org/) | @@ -811,6 +811,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2020-12-09 - [プロジェクトにOpenAPI Generatorで自動生成された型付きAPI Clientを導入した話](https://qiita.com/yoshifujiT/items/905c18700ede23f40840) by [@yoshifujiT](https://github.com/yoshifujiT) - 2020-12-15 - [Next.js + NestJS + GraphQLで変化に追従するフロントエンドへ 〜 ショッピングクーポンの事例紹介](https://techblog.yahoo.co.jp/entry/2020121530052952/) by [小倉 陸](https://github.com/ogugu9) at [Yahoo! JAPAN Tech Blog](https://techblog.yahoo.co.jp/) - 2021-01-08 - [Hello, New API – Part 1](https://www.nginx.com/blog/hello-new-api-part-1/) by [Jeremy Schulman](https://www.nginx.com/people/jeremy-schulman/) at [Major League Baseball](https://www.mlb.com) +- 2021-01-18 - [「アプリ開発あるある」を疑うことから始まった、API Clientコードの自動生成【デブスト2020】](https://codezine.jp/article/detail/13406?p=2) by [CodeZine編集部](https://codezine.jp/author/1) ## [6 - About Us](#table-of-contents) @@ -904,10 +905,11 @@ Here is a list of template creators: * TypeScript (Angular7): @topce * TypeScript (Axios): @nicokoenig * TypeScript (Fetch): @leonyu + * TypeScript (Inversify): @gualtierim * TypeScript (jQuery): @bherila + * TypeScript (Nestjs): @vfrank66 * TypeScript (Node): @mhardorf * TypeScript (Rxjs): @denyo - * TypeScript (Inversify): @gualtierim * TypeScript (redux-query): @petejohansonxo * Server Stubs * Ada: @stcarrez diff --git a/CI/bitrise.yml b/bitrise.yml similarity index 100% rename from CI/bitrise.yml rename to bitrise.yml From 0b2aa21f5d645cd6c5feb7b8af3b147209338b77 Mon Sep 17 00:00:00 2001 From: Francesco Guardiani Date: Wed, 27 Jan 2021 12:44:42 +0100 Subject: [PATCH 50/54] Bumped Vert.x template to Vert.x 4 GA (#8528) Signed-off-by: Francesco Guardiani --- .../JavaVertXWebServer/apiHandler.mustache | 6 +++--- .../supportFiles/HttpServerVerticle.mustache | 14 ++++++------- .../supportFiles/pom.mustache | 4 ++-- .../java-vertx-web/.openapi-generator/FILES | 2 -- .../java-vertx-web/.openapi-generator/VERSION | 2 +- .../server/petstore/java-vertx-web/pom.xml | 4 ++-- .../vertxweb/server/HttpServerVerticle.java | 18 ++++++++--------- .../vertxweb/server/api/PetApiHandler.java | 20 +++++++++---------- .../vertxweb/server/api/StoreApiHandler.java | 12 +++++------ .../vertxweb/server/api/UserApiHandler.java | 20 +++++++++---------- 10 files changed, 50 insertions(+), 52 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/apiHandler.mustache b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/apiHandler.mustache index b8cab88ea44..e9a6bbf0663 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/apiHandler.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/apiHandler.mustache @@ -5,7 +5,7 @@ package {{package}}; import com.fasterxml.jackson.core.type.TypeReference; import io.vertx.core.json.jackson.DatabindCodec; -import io.vertx.ext.web.openapi.RouterFactory; +import io.vertx.ext.web.openapi.RouterBuilder; import io.vertx.ext.web.validation.RequestParameters; import io.vertx.ext.web.validation.RequestParameter; import io.vertx.ext.web.validation.ValidationHandler; @@ -27,10 +27,10 @@ public class {{classname}}Handler { this.apiImpl = new {{classname}}Impl(); } - public void mount(RouterFactory factory) { + public void mount(RouterBuilder builder) { {{#operations}} {{#operation}} - factory.operation("{{operationId}}").handler(this::{{operationId}}); + builder.operation("{{operationId}}").handler(this::{{operationId}}); {{/operation}} {{/operations}} } diff --git a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/supportFiles/HttpServerVerticle.mustache b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/supportFiles/HttpServerVerticle.mustache index 51de8394f1a..03001005bca 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/supportFiles/HttpServerVerticle.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/supportFiles/HttpServerVerticle.mustache @@ -5,8 +5,8 @@ import io.vertx.core.Promise; import io.vertx.core.http.HttpServerOptions; import io.vertx.ext.web.Router; import io.vertx.ext.web.RoutingContext; -import io.vertx.ext.web.openapi.RouterFactory; -import io.vertx.ext.web.openapi.RouterFactoryOptions; +import io.vertx.ext.web.openapi.RouterBuilder; +import io.vertx.ext.web.openapi.RouterBuilderOptions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; {{#apiInfo}}{{#apis}} @@ -22,16 +22,16 @@ public class HttpServerVerticle extends AbstractVerticle { @Override public void start(Promise startPromise) { - RouterFactory.create(vertx, specFile) - .map(factory -> { - factory.setOptions(new RouterFactoryOptions() + RouterBuilder.create(vertx, specFile) + .map(builder -> { + builder.setOptions(new RouterBuilderOptions() // For production use case, you need to enable this flag and provide the proper security handler .setRequireSecurityHandlers(false) ); {{#apiInfo}}{{#apis}} - {{classVarName}}Handler.mount(factory);{{/apis}}{{/apiInfo}} + {{classVarName}}Handler.mount(builder);{{/apis}}{{/apiInfo}} - Router router = factory.createRouter(); + Router router = builder.createRouter(); router.errorHandler(400, this::validationFailureHandler); return router; diff --git a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/supportFiles/pom.mustache b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/supportFiles/pom.mustache index 6f3497cd231..da3bb233cf8 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/supportFiles/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/supportFiles/pom.mustache @@ -17,8 +17,8 @@ 2.22.2 1.5.0 - 4.0.0.Beta3 - 5.6.2 + 4.0.0 + 5.7.0 1.7.30 2.11.2 diff --git a/samples/server/petstore/java-vertx-web/.openapi-generator/FILES b/samples/server/petstore/java-vertx-web/.openapi-generator/FILES index 4169de32e26..08e93e05a0c 100644 --- a/samples/server/petstore/java-vertx-web/.openapi-generator/FILES +++ b/samples/server/petstore/java-vertx-web/.openapi-generator/FILES @@ -12,8 +12,6 @@ src/main/java/org/openapitools/vertxweb/server/api/UserApi.java src/main/java/org/openapitools/vertxweb/server/api/UserApiHandler.java src/main/java/org/openapitools/vertxweb/server/api/UserApiImpl.java src/main/java/org/openapitools/vertxweb/server/model/Category.java -src/main/java/org/openapitools/vertxweb/server/model/InlineObject.java -src/main/java/org/openapitools/vertxweb/server/model/InlineObject1.java src/main/java/org/openapitools/vertxweb/server/model/ModelApiResponse.java src/main/java/org/openapitools/vertxweb/server/model/Order.java src/main/java/org/openapitools/vertxweb/server/model/Pet.java diff --git a/samples/server/petstore/java-vertx-web/.openapi-generator/VERSION b/samples/server/petstore/java-vertx-web/.openapi-generator/VERSION index d99e7162d01..3fa3b389a57 100644 --- a/samples/server/petstore/java-vertx-web/.openapi-generator/VERSION +++ b/samples/server/petstore/java-vertx-web/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-vertx-web/pom.xml b/samples/server/petstore/java-vertx-web/pom.xml index e813663f8d1..56eebc06b10 100644 --- a/samples/server/petstore/java-vertx-web/pom.xml +++ b/samples/server/petstore/java-vertx-web/pom.xml @@ -17,8 +17,8 @@ 2.22.2 1.5.0 - 4.0.0.Beta3 - 5.6.2 + 4.0.0 + 5.7.0 1.7.30 2.11.2 diff --git a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/HttpServerVerticle.java b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/HttpServerVerticle.java index ceb3d606acd..f06b6c3e014 100644 --- a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/HttpServerVerticle.java +++ b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/HttpServerVerticle.java @@ -5,8 +5,8 @@ import io.vertx.core.Promise; import io.vertx.core.http.HttpServerOptions; import io.vertx.ext.web.Router; import io.vertx.ext.web.RoutingContext; -import io.vertx.ext.web.openapi.RouterFactory; -import io.vertx.ext.web.openapi.RouterFactoryOptions; +import io.vertx.ext.web.openapi.RouterBuilder; +import io.vertx.ext.web.openapi.RouterBuilderOptions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,18 +26,18 @@ public class HttpServerVerticle extends AbstractVerticle { @Override public void start(Promise startPromise) { - RouterFactory.create(vertx, specFile) - .map(factory -> { - factory.setOptions(new RouterFactoryOptions() + RouterBuilder.create(vertx, specFile) + .map(builder -> { + builder.setOptions(new RouterBuilderOptions() // For production use case, you need to enable this flag and provide the proper security handler .setRequireSecurityHandlers(false) ); - petHandler.mount(factory); - storeHandler.mount(factory); - userHandler.mount(factory); + petHandler.mount(builder); + storeHandler.mount(builder); + userHandler.mount(builder); - Router router = factory.createRouter(); + Router router = builder.createRouter(); router.errorHandler(400, this::validationFailureHandler); return router; diff --git a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/PetApiHandler.java b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/PetApiHandler.java index 9dd5df60d58..d215f5db7c5 100644 --- a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/PetApiHandler.java +++ b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/PetApiHandler.java @@ -6,7 +6,7 @@ import org.openapitools.vertxweb.server.model.Pet; import com.fasterxml.jackson.core.type.TypeReference; import io.vertx.core.json.jackson.DatabindCodec; -import io.vertx.ext.web.openapi.RouterFactory; +import io.vertx.ext.web.openapi.RouterBuilder; import io.vertx.ext.web.validation.RequestParameters; import io.vertx.ext.web.validation.RequestParameter; import io.vertx.ext.web.validation.ValidationHandler; @@ -28,15 +28,15 @@ public class PetApiHandler { this.apiImpl = new PetApiImpl(); } - public void mount(RouterFactory factory) { - factory.operation("addPet").handler(this::addPet); - factory.operation("deletePet").handler(this::deletePet); - factory.operation("findPetsByStatus").handler(this::findPetsByStatus); - factory.operation("findPetsByTags").handler(this::findPetsByTags); - factory.operation("getPetById").handler(this::getPetById); - factory.operation("updatePet").handler(this::updatePet); - factory.operation("updatePetWithForm").handler(this::updatePetWithForm); - factory.operation("uploadFile").handler(this::uploadFile); + public void mount(RouterBuilder builder) { + builder.operation("addPet").handler(this::addPet); + builder.operation("deletePet").handler(this::deletePet); + builder.operation("findPetsByStatus").handler(this::findPetsByStatus); + builder.operation("findPetsByTags").handler(this::findPetsByTags); + builder.operation("getPetById").handler(this::getPetById); + builder.operation("updatePet").handler(this::updatePet); + builder.operation("updatePetWithForm").handler(this::updatePetWithForm); + builder.operation("uploadFile").handler(this::uploadFile); } private void addPet(RoutingContext routingContext) { diff --git a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/StoreApiHandler.java b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/StoreApiHandler.java index 32b410ad2f6..584f7cc633d 100644 --- a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/StoreApiHandler.java +++ b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/StoreApiHandler.java @@ -4,7 +4,7 @@ import org.openapitools.vertxweb.server.model.Order; import com.fasterxml.jackson.core.type.TypeReference; import io.vertx.core.json.jackson.DatabindCodec; -import io.vertx.ext.web.openapi.RouterFactory; +import io.vertx.ext.web.openapi.RouterBuilder; import io.vertx.ext.web.validation.RequestParameters; import io.vertx.ext.web.validation.RequestParameter; import io.vertx.ext.web.validation.ValidationHandler; @@ -26,11 +26,11 @@ public class StoreApiHandler { this.apiImpl = new StoreApiImpl(); } - public void mount(RouterFactory factory) { - factory.operation("deleteOrder").handler(this::deleteOrder); - factory.operation("getInventory").handler(this::getInventory); - factory.operation("getOrderById").handler(this::getOrderById); - factory.operation("placeOrder").handler(this::placeOrder); + public void mount(RouterBuilder builder) { + builder.operation("deleteOrder").handler(this::deleteOrder); + builder.operation("getInventory").handler(this::getInventory); + builder.operation("getOrderById").handler(this::getOrderById); + builder.operation("placeOrder").handler(this::placeOrder); } private void deleteOrder(RoutingContext routingContext) { diff --git a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiHandler.java b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiHandler.java index dfcbd41aef8..db26552844e 100644 --- a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiHandler.java +++ b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiHandler.java @@ -4,7 +4,7 @@ import org.openapitools.vertxweb.server.model.User; import com.fasterxml.jackson.core.type.TypeReference; import io.vertx.core.json.jackson.DatabindCodec; -import io.vertx.ext.web.openapi.RouterFactory; +import io.vertx.ext.web.openapi.RouterBuilder; import io.vertx.ext.web.validation.RequestParameters; import io.vertx.ext.web.validation.RequestParameter; import io.vertx.ext.web.validation.ValidationHandler; @@ -26,15 +26,15 @@ public class UserApiHandler { this.apiImpl = new UserApiImpl(); } - public void mount(RouterFactory factory) { - factory.operation("createUser").handler(this::createUser); - factory.operation("createUsersWithArrayInput").handler(this::createUsersWithArrayInput); - factory.operation("createUsersWithListInput").handler(this::createUsersWithListInput); - factory.operation("deleteUser").handler(this::deleteUser); - factory.operation("getUserByName").handler(this::getUserByName); - factory.operation("loginUser").handler(this::loginUser); - factory.operation("logoutUser").handler(this::logoutUser); - factory.operation("updateUser").handler(this::updateUser); + public void mount(RouterBuilder builder) { + builder.operation("createUser").handler(this::createUser); + builder.operation("createUsersWithArrayInput").handler(this::createUsersWithArrayInput); + builder.operation("createUsersWithListInput").handler(this::createUsersWithListInput); + builder.operation("deleteUser").handler(this::deleteUser); + builder.operation("getUserByName").handler(this::getUserByName); + builder.operation("loginUser").handler(this::loginUser); + builder.operation("logoutUser").handler(this::logoutUser); + builder.operation("updateUser").handler(this::updateUser); } private void createUser(RoutingContext routingContext) { From a2a88cb8f08ba09e90b47c45e18c082240eae184 Mon Sep 17 00:00:00 2001 From: Chris Coltsman <59687842+ccoltx@users.noreply.github.com> Date: Thu, 28 Jan 2021 06:04:03 +0100 Subject: [PATCH 51/54] Spring codegen - fix equals and hashCode methods for byte array and binary (#8345) * Spring codegen - fix equals and hashCode methods for byte array and binary - they should be compared using Arrays.equals - they're hash code generated using Arrays.hashCode * Corrected checkstyle issues * Revert changes for binary types --- .../openapitools/codegen/languages/AbstractJavaCodegen.java | 1 + .../org/openapitools/codegen/languages/SpringCodegen.java | 5 +++++ .../src/main/resources/JavaSpring/pojo.mustache | 4 ++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- .../java/org/openapitools/virtualan/model/FormatTest.java | 5 +++-- .../src/main/java/org/openapitools/model/FormatTest.java | 5 +++-- 21 files changed, 62 insertions(+), 38 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 5eb54b986f8..bf4e138bcb9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -517,6 +517,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code importMapping.put("JsonReader", "com.google.gson.stream.JsonReader"); importMapping.put("JsonWriter", "com.google.gson.stream.JsonWriter"); importMapping.put("IOException", "java.io.IOException"); + importMapping.put("Arrays", "java.util.Arrays"); importMapping.put("Objects", "java.util.Objects"); importMapping.put("StringUtil", invokerPackage + ".StringUtil"); // import JsonCreator if JsonProperty is imported diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index fa8304e3ded..409267e3194 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -833,6 +833,11 @@ public class SpringCodegen extends AbstractJavaCodegen model.imports.add("JsonCreator"); } } + + // Add imports for java.util.Arrays + if (property.isByteArray) { + model.imports.add("Arrays"); + } } @Override diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index a07d9a62f1d..3938d4d289e 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -132,7 +132,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}} return false; }{{#hasVars}} {{classname}} {{classVarName}} = ({{classname}}) o; - return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} && + return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} && {{/-last}}{{/vars}}{{#parent}} && super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} return true;{{/hasVars}} @@ -140,7 +140,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}} @Override public int hashCode() { - return Objects.hash({{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); } @Override diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/FormatTest.java index 405b557aa80..e894f561fc6 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/FormatTest.java index 6d17fb8c2c7..04e164b1c52 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/FormatTest.java index 05758282250..0962957d79f 100644 --- a/samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import javax.validation.Valid; import javax.validation.constraints.*; @@ -378,7 +379,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -389,7 +390,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java index 405b557aa80..e894f561fc6 100644 --- a/samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/FormatTest.java index 60f5bd280ce..80ea59cef11 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -381,7 +382,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -392,7 +393,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/FormatTest.java index 36a1cc3cd73..60247deff4c 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/FormatTest.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import java.util.Arrays; import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; @@ -378,7 +379,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -389,7 +390,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java index 405b557aa80..e894f561fc6 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java index 405b557aa80..e894f561fc6 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java index 405b557aa80..e894f561fc6 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java index 405b557aa80..e894f561fc6 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java index 405b557aa80..e894f561fc6 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/FormatTest.java index 86a469d40a2..dedb11fe758 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/FormatTest.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import java.util.Arrays; import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/FormatTest.java index 405b557aa80..e894f561fc6 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/FormatTest.java index 86a469d40a2..dedb11fe758 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/FormatTest.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import java.util.Arrays; import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java index 405b557aa80..e894f561fc6 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java index 405b557aa80..e894f561fc6 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java index d107fa6819c..d58e787c368 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTest.java index 405b557aa80..e894f561fc6 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; @@ -379,7 +380,7 @@ public class FormatTest { Objects.equals(this._float, formatTest._float) && Objects.equals(this._double, formatTest._double) && Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && + Arrays.equals(this._byte, formatTest._byte) && Objects.equals(this.binary, formatTest.binary) && Objects.equals(this.date, formatTest.date) && Objects.equals(this.dateTime, formatTest.dateTime) && @@ -390,7 +391,7 @@ public class FormatTest { @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); } @Override From 5b82ed940762846689f95d9b2cd1f541385c58fd Mon Sep 17 00:00:00 2001 From: MarcelTon Date: Thu, 28 Jan 2021 07:00:37 +0100 Subject: [PATCH 52/54] [BUG][Java]Fixed defaultValue escaping in Vert.x server template (#5321) * Fixed defaultValue escaping in Vert.x server template * Ran all java/vertx scripts in bin folder (java-vertx-*, java-petstore-vertx) and committed result. Co-authored-by: William Cheng --- .../JavaVertXServer/apiVerticle.mustache | 4 ++-- .../async/.openapi-generator/VERSION | 2 +- .../server/petstore/java-vertx/async/pom.xml | 4 ++-- .../server/api/MainApiVerticle.java | 8 ++++---- .../server/api/verticle/PetApiVerticle.java | 18 +++++++++--------- .../server/api/verticle/StoreApiVerticle.java | 10 +++++----- .../server/api/verticle/UserApiVerticle.java | 18 +++++++++--------- .../async/src/main/resources/openapi.json | 3 ++- .../java-vertx/rx/.openapi-generator/VERSION | 2 +- samples/server/petstore/java-vertx/rx/pom.xml | 4 ++-- .../server/api/MainApiVerticle.java | 8 ++++---- .../server/api/verticle/PetApiVerticle.java | 18 +++++++++--------- .../server/api/verticle/StoreApiVerticle.java | 10 +++++----- .../server/api/verticle/UserApiVerticle.java | 18 +++++++++--------- .../rx/src/main/resources/openapi.json | 3 ++- 15 files changed, 66 insertions(+), 64 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaVertXServer/apiVerticle.mustache b/modules/openapi-generator/src/main/resources/JavaVertXServer/apiVerticle.mustache index 884426b8d5f..84a896245fb 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXServer/apiVerticle.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXServer/apiVerticle.mustache @@ -52,7 +52,7 @@ public class {{classname}}Verticle extends AbstractVerticle { Json.mapper.getTypeFactory().constructCollectionType(List.class, {{{baseType}}}.class)); {{/required}} {{^required}} - {{{dataType}}} {{paramName}} = ({{paramName}}Param == null) ? {{#defaultValue}}{{defaultValue}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : Json.mapper.readValue({{paramName}}Param.encode(), + {{{dataType}}} {{paramName}} = ({{paramName}}Param == null) ? {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : Json.mapper.readValue({{paramName}}Param.encode(), Json.mapper.getTypeFactory().constructCollectionType(List.class, {{{baseType}}}.class)); {{/required}} {{/isArray}} @@ -81,7 +81,7 @@ public class {{classname}}Verticle extends AbstractVerticle { {{{dataType}}} {{paramName}} = Json.mapper.readValue({{paramName}}Param, {{{dataType}}}.class); {{/required}} {{^required}} - {{{dataType}}} {{paramName}} = ({{paramName}}Param == null) ? {{#defaultValue}}{{defaultValue}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : Json.mapper.readValue({{paramName}}Param, {{{dataType}}}.class); + {{{dataType}}} {{paramName}} = ({{paramName}}Param == null) ? {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : Json.mapper.readValue({{paramName}}Param, {{{dataType}}}.class); {{/required}} {{/isString}} {{/isPrimitiveType}} diff --git a/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION b/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION index d99e7162d01..3fa3b389a57 100644 --- a/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION +++ b/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/pom.xml b/samples/server/petstore/java-vertx/async/pom.xml index 045fe15ed66..217266e583e 100644 --- a/samples/server/petstore/java-vertx/async/pom.xml +++ b/samples/server/petstore/java-vertx/async/pom.xml @@ -12,7 +12,7 @@ UTF-8 1.8 - 4.13 + 4.13.1 3.4.1 3.8.1 1.4.0 @@ -88,4 +88,4 @@ - \ No newline at end of file + diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiVerticle.java index 695ca48e592..26381f058f1 100644 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiVerticle.java +++ b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiVerticle.java @@ -19,7 +19,7 @@ import io.vertx.core.Vertx; import io.vertx.ext.web.Router; public class MainApiVerticle extends AbstractVerticle { - final static Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class); + static final Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class); private int serverPort = 8080; protected Router router; @@ -59,9 +59,9 @@ public class MainApiVerticle extends AbstractVerticle { } }); } else { - startFuture.fail(readFile.cause()); + startFuture.fail(readFile.cause()); } - }); + }); } public void deployVerticles(Future startFuture) { @@ -94,4 +94,4 @@ public class MainApiVerticle extends AbstractVerticle { }); } -} \ No newline at end of file +} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java index 4b3aa4cfb38..d1849cb43f1 100644 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java +++ b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java @@ -17,16 +17,16 @@ import java.util.List; import java.util.Map; public class PetApiVerticle extends AbstractVerticle { - final static Logger LOGGER = LoggerFactory.getLogger(PetApiVerticle.class); + static final Logger LOGGER = LoggerFactory.getLogger(PetApiVerticle.class); - final static String ADDPET_SERVICE_ID = "addPet"; - final static String DELETEPET_SERVICE_ID = "deletePet"; - final static String FINDPETSBYSTATUS_SERVICE_ID = "findPetsByStatus"; - final static String FINDPETSBYTAGS_SERVICE_ID = "findPetsByTags"; - final static String GETPETBYID_SERVICE_ID = "getPetById"; - final static String UPDATEPET_SERVICE_ID = "updatePet"; - final static String UPDATEPETWITHFORM_SERVICE_ID = "updatePetWithForm"; - final static String UPLOADFILE_SERVICE_ID = "uploadFile"; + static final String ADDPET_SERVICE_ID = "addPet"; + static final String DELETEPET_SERVICE_ID = "deletePet"; + static final String FINDPETSBYSTATUS_SERVICE_ID = "findPetsByStatus"; + static final String FINDPETSBYTAGS_SERVICE_ID = "findPetsByTags"; + static final String GETPETBYID_SERVICE_ID = "getPetById"; + static final String UPDATEPET_SERVICE_ID = "updatePet"; + static final String UPDATEPETWITHFORM_SERVICE_ID = "updatePetWithForm"; + static final String UPLOADFILE_SERVICE_ID = "uploadFile"; final PetApi service; diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java index f83133b94b4..b8cb7b01f36 100644 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java +++ b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java @@ -15,12 +15,12 @@ import java.util.List; import java.util.Map; public class StoreApiVerticle extends AbstractVerticle { - final static Logger LOGGER = LoggerFactory.getLogger(StoreApiVerticle.class); + static final Logger LOGGER = LoggerFactory.getLogger(StoreApiVerticle.class); - final static String DELETEORDER_SERVICE_ID = "deleteOrder"; - final static String GETINVENTORY_SERVICE_ID = "getInventory"; - final static String GETORDERBYID_SERVICE_ID = "getOrderById"; - final static String PLACEORDER_SERVICE_ID = "placeOrder"; + static final String DELETEORDER_SERVICE_ID = "deleteOrder"; + static final String GETINVENTORY_SERVICE_ID = "getInventory"; + static final String GETORDERBYID_SERVICE_ID = "getOrderById"; + static final String PLACEORDER_SERVICE_ID = "placeOrder"; final StoreApi service; diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java index 8773908b5a0..61ac44f5584 100644 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java +++ b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java @@ -15,16 +15,16 @@ import java.util.List; import java.util.Map; public class UserApiVerticle extends AbstractVerticle { - final static Logger LOGGER = LoggerFactory.getLogger(UserApiVerticle.class); + static final Logger LOGGER = LoggerFactory.getLogger(UserApiVerticle.class); - final static String CREATEUSER_SERVICE_ID = "createUser"; - final static String CREATEUSERSWITHARRAYINPUT_SERVICE_ID = "createUsersWithArrayInput"; - final static String CREATEUSERSWITHLISTINPUT_SERVICE_ID = "createUsersWithListInput"; - final static String DELETEUSER_SERVICE_ID = "deleteUser"; - final static String GETUSERBYNAME_SERVICE_ID = "getUserByName"; - final static String LOGINUSER_SERVICE_ID = "loginUser"; - final static String LOGOUTUSER_SERVICE_ID = "logoutUser"; - final static String UPDATEUSER_SERVICE_ID = "updateUser"; + static final String CREATEUSER_SERVICE_ID = "createUser"; + static final String CREATEUSERSWITHARRAYINPUT_SERVICE_ID = "createUsersWithArrayInput"; + static final String CREATEUSERSWITHLISTINPUT_SERVICE_ID = "createUsersWithListInput"; + static final String DELETEUSER_SERVICE_ID = "deleteUser"; + static final String GETUSERBYNAME_SERVICE_ID = "getUserByName"; + static final String LOGINUSER_SERVICE_ID = "loginUser"; + static final String LOGOUTUSER_SERVICE_ID = "logoutUser"; + static final String UPDATEUSER_SERVICE_ID = "updateUser"; final UserApi service; diff --git a/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json b/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json index 2f40e269947..c292bb5e95a 100644 --- a/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json +++ b/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json @@ -1077,5 +1077,6 @@ "type" : "apiKey" } } - } + }, + "x-original-swagger-version" : "2.0" } \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION b/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION index d99e7162d01..3fa3b389a57 100644 --- a/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION +++ b/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/pom.xml b/samples/server/petstore/java-vertx/rx/pom.xml index 94552601511..2b575c68e75 100644 --- a/samples/server/petstore/java-vertx/rx/pom.xml +++ b/samples/server/petstore/java-vertx/rx/pom.xml @@ -12,7 +12,7 @@ UTF-8 1.8 - 4.13 + 4.13.1 3.4.1 3.8.1 1.4.0 @@ -88,4 +88,4 @@ - \ No newline at end of file + diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiVerticle.java index 695ca48e592..26381f058f1 100644 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiVerticle.java +++ b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiVerticle.java @@ -19,7 +19,7 @@ import io.vertx.core.Vertx; import io.vertx.ext.web.Router; public class MainApiVerticle extends AbstractVerticle { - final static Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class); + static final Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class); private int serverPort = 8080; protected Router router; @@ -59,9 +59,9 @@ public class MainApiVerticle extends AbstractVerticle { } }); } else { - startFuture.fail(readFile.cause()); + startFuture.fail(readFile.cause()); } - }); + }); } public void deployVerticles(Future startFuture) { @@ -94,4 +94,4 @@ public class MainApiVerticle extends AbstractVerticle { }); } -} \ No newline at end of file +} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java index 7caf45dfd24..2d5cfdb068b 100644 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java +++ b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java @@ -17,16 +17,16 @@ import java.util.List; import java.util.Map; public class PetApiVerticle extends AbstractVerticle { - final static Logger LOGGER = LoggerFactory.getLogger(PetApiVerticle.class); + static final Logger LOGGER = LoggerFactory.getLogger(PetApiVerticle.class); - final static String ADDPET_SERVICE_ID = "addPet"; - final static String DELETEPET_SERVICE_ID = "deletePet"; - final static String FINDPETSBYSTATUS_SERVICE_ID = "findPetsByStatus"; - final static String FINDPETSBYTAGS_SERVICE_ID = "findPetsByTags"; - final static String GETPETBYID_SERVICE_ID = "getPetById"; - final static String UPDATEPET_SERVICE_ID = "updatePet"; - final static String UPDATEPETWITHFORM_SERVICE_ID = "updatePetWithForm"; - final static String UPLOADFILE_SERVICE_ID = "uploadFile"; + static final String ADDPET_SERVICE_ID = "addPet"; + static final String DELETEPET_SERVICE_ID = "deletePet"; + static final String FINDPETSBYSTATUS_SERVICE_ID = "findPetsByStatus"; + static final String FINDPETSBYTAGS_SERVICE_ID = "findPetsByTags"; + static final String GETPETBYID_SERVICE_ID = "getPetById"; + static final String UPDATEPET_SERVICE_ID = "updatePet"; + static final String UPDATEPETWITHFORM_SERVICE_ID = "updatePetWithForm"; + static final String UPLOADFILE_SERVICE_ID = "uploadFile"; final PetApi service; diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java index 6e1a60becac..f8b2d9ce0aa 100644 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java +++ b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java @@ -15,12 +15,12 @@ import java.util.List; import java.util.Map; public class StoreApiVerticle extends AbstractVerticle { - final static Logger LOGGER = LoggerFactory.getLogger(StoreApiVerticle.class); + static final Logger LOGGER = LoggerFactory.getLogger(StoreApiVerticle.class); - final static String DELETEORDER_SERVICE_ID = "deleteOrder"; - final static String GETINVENTORY_SERVICE_ID = "getInventory"; - final static String GETORDERBYID_SERVICE_ID = "getOrderById"; - final static String PLACEORDER_SERVICE_ID = "placeOrder"; + static final String DELETEORDER_SERVICE_ID = "deleteOrder"; + static final String GETINVENTORY_SERVICE_ID = "getInventory"; + static final String GETORDERBYID_SERVICE_ID = "getOrderById"; + static final String PLACEORDER_SERVICE_ID = "placeOrder"; final StoreApi service; diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java index 7233d8e3e29..756b31863fa 100644 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java +++ b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java @@ -15,16 +15,16 @@ import java.util.List; import java.util.Map; public class UserApiVerticle extends AbstractVerticle { - final static Logger LOGGER = LoggerFactory.getLogger(UserApiVerticle.class); + static final Logger LOGGER = LoggerFactory.getLogger(UserApiVerticle.class); - final static String CREATEUSER_SERVICE_ID = "createUser"; - final static String CREATEUSERSWITHARRAYINPUT_SERVICE_ID = "createUsersWithArrayInput"; - final static String CREATEUSERSWITHLISTINPUT_SERVICE_ID = "createUsersWithListInput"; - final static String DELETEUSER_SERVICE_ID = "deleteUser"; - final static String GETUSERBYNAME_SERVICE_ID = "getUserByName"; - final static String LOGINUSER_SERVICE_ID = "loginUser"; - final static String LOGOUTUSER_SERVICE_ID = "logoutUser"; - final static String UPDATEUSER_SERVICE_ID = "updateUser"; + static final String CREATEUSER_SERVICE_ID = "createUser"; + static final String CREATEUSERSWITHARRAYINPUT_SERVICE_ID = "createUsersWithArrayInput"; + static final String CREATEUSERSWITHLISTINPUT_SERVICE_ID = "createUsersWithListInput"; + static final String DELETEUSER_SERVICE_ID = "deleteUser"; + static final String GETUSERBYNAME_SERVICE_ID = "getUserByName"; + static final String LOGINUSER_SERVICE_ID = "loginUser"; + static final String LOGOUTUSER_SERVICE_ID = "logoutUser"; + static final String UPDATEUSER_SERVICE_ID = "updateUser"; final UserApi service; diff --git a/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json b/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json index 2f40e269947..c292bb5e95a 100644 --- a/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json +++ b/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json @@ -1077,5 +1077,6 @@ "type" : "apiKey" } } - } + }, + "x-original-swagger-version" : "2.0" } \ No newline at end of file From e377eabbc5e8db3cd48c58c4a6fe00bafae09322 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> Date: Thu, 28 Jan 2021 04:26:42 -0300 Subject: [PATCH 53/54] Fix #8492 - Use Vertx reference instead of static class (#8501) --- .../main/resources/Java/libraries/vertx/ApiClient.mustache | 4 ++-- .../src/main/java/org/openapitools/client/ApiClient.java | 4 ++-- .../src/main/java/org/openapitools/client/ApiClient.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache index 3c17645d6c8..83b6e863ae2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache @@ -123,10 +123,10 @@ public class ApiClient{{#java8}} extends JavaTimeFormatter{{/java8}} { public synchronized WebClient getWebClient() { String webClientIdentifier = "web-client-" + identifier; - WebClient webClient = Vertx.currentContext().get(webClientIdentifier); + WebClient webClient = this.vertx.getOrCreateContext().get(webClientIdentifier); if (webClient == null) { webClient = buildWebClient(vertx, config); - Vertx.currentContext().put(webClientIdentifier, webClient); + this.vertx.getOrCreateContext().put(webClientIdentifier, webClient); } return webClient; } diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/ApiClient.java index c7b8edf8743..10f7d1935d0 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/ApiClient.java @@ -112,10 +112,10 @@ public class ApiClient extends JavaTimeFormatter { public synchronized WebClient getWebClient() { String webClientIdentifier = "web-client-" + identifier; - WebClient webClient = Vertx.currentContext().get(webClientIdentifier); + WebClient webClient = this.vertx.getOrCreateContext().get(webClientIdentifier); if (webClient == null) { webClient = buildWebClient(vertx, config); - Vertx.currentContext().put(webClientIdentifier, webClient); + this.vertx.getOrCreateContext().put(webClientIdentifier, webClient); } return webClient; } diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java index 07b0da20acc..7b2ef6e985f 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java @@ -115,10 +115,10 @@ public class ApiClient extends JavaTimeFormatter { public synchronized WebClient getWebClient() { String webClientIdentifier = "web-client-" + identifier; - WebClient webClient = Vertx.currentContext().get(webClientIdentifier); + WebClient webClient = this.vertx.getOrCreateContext().get(webClientIdentifier); if (webClient == null) { webClient = buildWebClient(vertx, config); - Vertx.currentContext().put(webClientIdentifier, webClient); + this.vertx.getOrCreateContext().put(webClientIdentifier, webClient); } return webClient; } From f88744159149489e4e0f332d2587d4e19ce352b2 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 28 Jan 2021 16:47:09 +0800 Subject: [PATCH 54/54] update samples --- .../OpenAPIClient-net5.0/.openapi-generator/VERSION | 2 +- .../petstore/swift5/alamofireLibrary/.openapi-generator/VERSION | 2 +- .../petstore/swift5/combineLibrary/.openapi-generator/VERSION | 2 +- .../client/petstore/swift5/default/.openapi-generator/VERSION | 2 +- .../petstore/swift5/deprecated/.openapi-generator/VERSION | 2 +- .../petstore/swift5/nonPublicApi/.openapi-generator/VERSION | 2 +- .../petstore/swift5/objcCompatible/.openapi-generator/VERSION | 2 +- .../swift5/promisekitLibrary/.openapi-generator/VERSION | 2 +- .../swift5/readonlyProperties/.openapi-generator/VERSION | 2 +- .../petstore/swift5/resultLibrary/.openapi-generator/VERSION | 2 +- .../petstore/swift5/rxswiftLibrary/.openapi-generator/VERSION | 2 +- .../swift5/urlsessionLibrary/.openapi-generator/VERSION | 2 +- .../builds/default/.openapi-generator/VERSION | 2 +- .../server/petstore/java-undertow/.openapi-generator/VERSION | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/VERSION b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/alamofireLibrary/.openapi-generator/VERSION b/samples/client/petstore/swift5/alamofireLibrary/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/.openapi-generator/VERSION +++ b/samples/client/petstore/swift5/alamofireLibrary/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/combineLibrary/.openapi-generator/VERSION b/samples/client/petstore/swift5/combineLibrary/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/swift5/combineLibrary/.openapi-generator/VERSION +++ b/samples/client/petstore/swift5/combineLibrary/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/default/.openapi-generator/VERSION b/samples/client/petstore/swift5/default/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/swift5/default/.openapi-generator/VERSION +++ b/samples/client/petstore/swift5/default/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/deprecated/.openapi-generator/VERSION b/samples/client/petstore/swift5/deprecated/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/swift5/deprecated/.openapi-generator/VERSION +++ b/samples/client/petstore/swift5/deprecated/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/nonPublicApi/.openapi-generator/VERSION b/samples/client/petstore/swift5/nonPublicApi/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/swift5/nonPublicApi/.openapi-generator/VERSION +++ b/samples/client/petstore/swift5/nonPublicApi/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/objcCompatible/.openapi-generator/VERSION b/samples/client/petstore/swift5/objcCompatible/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/swift5/objcCompatible/.openapi-generator/VERSION +++ b/samples/client/petstore/swift5/objcCompatible/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/promisekitLibrary/.openapi-generator/VERSION b/samples/client/petstore/swift5/promisekitLibrary/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/.openapi-generator/VERSION +++ b/samples/client/petstore/swift5/promisekitLibrary/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/readonlyProperties/.openapi-generator/VERSION b/samples/client/petstore/swift5/readonlyProperties/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/swift5/readonlyProperties/.openapi-generator/VERSION +++ b/samples/client/petstore/swift5/readonlyProperties/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/resultLibrary/.openapi-generator/VERSION b/samples/client/petstore/swift5/resultLibrary/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/swift5/resultLibrary/.openapi-generator/VERSION +++ b/samples/client/petstore/swift5/resultLibrary/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/rxswiftLibrary/.openapi-generator/VERSION b/samples/client/petstore/swift5/rxswiftLibrary/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/.openapi-generator/VERSION +++ b/samples/client/petstore/swift5/rxswiftLibrary/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/urlsessionLibrary/.openapi-generator/VERSION b/samples/client/petstore/swift5/urlsessionLibrary/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/.openapi-generator/VERSION +++ b/samples/client/petstore/swift5/urlsessionLibrary/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/VERSION b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-undertow/.openapi-generator/VERSION b/samples/server/petstore/java-undertow/.openapi-generator/VERSION index 3fa3b389a57..c30f0ec2be7 100644 --- a/samples/server/petstore/java-undertow/.openapi-generator/VERSION +++ b/samples/server/petstore/java-undertow/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file